Paint the MDI Form with the desktop using PaintDesktop API in VB6
Posted on 2006-06-29
I am using the following code to paint a normal form and it works.
In the standard module i have the declaration for PaintDesktop
Public Declare Function PaintDesktop Lib "user32" (ByVal hdc As Long) As
Now I am not able to get the Me.hdc for the MDI Form. So I used the
following additional API calls.
Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Now in the MDI Form I use the code:
Dim lngLong As Long, hdc As Long
hdc = GetDC(GetDesktopWindow())
lngLong = PaintDesktop(hdc)
the result in lngLong is 1 but the MDIForm is not painted with the