Declare Function GetDesktopWindow Lib "user32.dll" () As Long
Platforms: Win 32s, Win 95/98, Win NT
GetDesktopWindow returns a handle to the desktop window. The desktop window is the window that makes up the desktop of the computer -- that is, the screen. If the function fails, it will return 0 instead of the handle.
Example:
' Find the device context of the desktop
' The handle to the desktop is needed to find the device context
Dim deskhwnd As Long ' handle to the desktop
Dim deskhdc As Long ' device context to the desktop
Dim retval As Long ' return value
deskhwnd = GetDesktopWindow() ' get the desktop's handle
deskhdc = GetDC(deskhwnd) ' get the desktop's device context
' You could put any code that works with the desktop here
retval = ReleaseDC(deskhwnd, deskhdc) ' free up resources associated with the device context
Category: Windows
Back to the index.