C# equivalent to Win32 API 'LockWindowUpdate'?

D

Dan H.

Hello,

I've been having a pickle of time trying to find any information about the
following. The Win32 API has a function called 'LockWindowUpdate' which, if
I'm not mistaken, prohibits all painting of the window including children
controls until unlocked. The only thing that I can find that even seems
close in .NET is SuspendLayout and ResumeLayout, but these don't really
effect painting - just sizing, moving, docking, and anchoring. Painting
elements such as text and color still can be seen. I even went so far as to
create a DLLImport within my .NET form for the 'LockWindowUpdate' API, but
when I used it, it had very adverse effects - painting got all messed up.
It seems like such a simple concept: I don't want my form to paint anything
until I tell it to - specifically only after all initialization has been
complete. What am I missing? Any and all information about this topic
would be most appreciated.

Thank you,
Dan
 
M

Matt Garven

I have used the LockWindowUpdate API call without problems. Call with
Handle, release by calling again with 0.

[DllImport("user32.dll", EntryPoint="LockWindowUpdate", SetLastError=true,
ExactSpelling=true, CharSet=CharSet.Auto,
CallingConvention=CallingConvention.StdCall)]

private static extern long LockWindow(long Handle);


Perhaps try a Form.Invalidate afterward?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top