GetDesktopWindow Function

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

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/g/getdesktopwindow.html