Home

Created By Wesley Griffin

 
 
Retrieve the Handle to the Desktop Window.
 
  Home > Source CodeSystem/API > Desktop Handle
 
  What is the Desktop Window?

The desktop window is the bottom most window.  It covers the entire screen and is the window that all other windows and icons are painted over.  It is useful to know when you need to enumerate all the windows that are opened.

 
  How do I retrieve the handle of the desktop window?

You can simply retrieve the desktop window by using the following code in the code window of a form.

 
 
Declare Function GetDesktopWindow Lib "user32" () As Long
 
'To call the desktop window use following code in a sub or function:
 Dim lngH as Long
 lngH = GetDesktopWindow()
 
 

Top

 
  Warning:
All material from this site must be used at own risk.  VB First Aid will take no responsibility for any loss of data or any other errors.  The material on this site was written for Visual Basic Version 6, therefore compatibility with other versions may cause errors.