Declare Function GetDesktopWindow Lib "user32.dll" () As Long
GetDesktopWindow returns the handle (hWnd) of the desktop window. The desktop window is the image on the computer's monitor without the cursor -- that is, it is the screen. While you could theoretically use this with the GetDC function to draw directly on the desktop, it is obviously not recommended and could lead to unpredictable, disasterous results. If the function fails, it will return 0 instead of the handle.
Example:
' Get the handle of the desktop
desktophWnd = GetDesktopWindow()
Category: System Information
Back to the index.