Getting the dekstop window handle
-
How do I get the handle to the Windows desktop I dont think GetDesktopWindow returns the handle to the Windows desktop Thanks Sujay
sujayg wrote:
I dont think GetDesktopWindow returns the handle to the Windows desktop
Documentation says that it does. [^] Nuri Ismail
-
How do I get the handle to the Windows desktop I dont think GetDesktopWindow returns the handle to the Windows desktop Thanks Sujay
sujayg wrote:
dont think GetDesktopWindow returns the handle to the Windows desktop
MSDN [^]:
The GetDesktopWindow function returns a handle to the desktop window.
I see a conflict... :rolleyes:
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
sujayg wrote:
dont think GetDesktopWindow returns the handle to the Windows desktop
MSDN [^]:
The GetDesktopWindow function returns a handle to the desktop window.
I see a conflict... :rolleyes:
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Hello Ian, Yes the name is a bit confusing. The desktop handle is the main WIndow on top of which all Windows are painted . But it does not return the handle of the Window ( SysListView32 ) - which is the WIndows desktop . This can be checked with Spy++ There is another function, GetShellWindow, which "probably" returns the Windows desktop handle, I am testing that Sujay
-
Hello Ian, Yes the name is a bit confusing. The desktop handle is the main WIndow on top of which all Windows are painted . But it does not return the handle of the Window ( SysListView32 ) - which is the WIndows desktop . This can be checked with Spy++ There is another function, GetShellWindow, which "probably" returns the Windows desktop handle, I am testing that Sujay
sujayg wrote:
But it does not return the handle of the Window ( SysListView32 )
that list view is not the desktop window, it is a child of a child of the desktop. you can verify that with Spy++ by looking at the ID of the Desktop window as shown in the default window list compared to the ID of that list view. the listview is a child of the Program Manager, which is the Windows Shell.
-
sujayg wrote:
But it does not return the handle of the Window ( SysListView32 )
that list view is not the desktop window, it is a child of a child of the desktop. you can verify that with Spy++ by looking at the ID of the Desktop window as shown in the default window list compared to the ID of that list view. the listview is a child of the Program Manager, which is the Windows Shell.
-
Any idea how can I get the handle to that I guess I need to use FindWindow or FindWinodwEx, but on what. If you can help me with the code or at least the logic, I can try
use FindWindow to find "Program Manager", then use EnumChildWindows on its children. or, the long way... get the desktop window, then use EnumChildWindows to find the listview. note that EnumChildWindows is recursive, so it will do a search of every window in the system if you start at the desktop. but, just look for a window of the SysListView32 type whose parent is the "Program Manager".
-
Any idea how can I get the handle to that I guess I need to use FindWindow or FindWinodwEx, but on what. If you can help me with the code or at least the logic, I can try
Try this:
HWND hProgMan = FindWindow("Progman", NULL);
HWND hDefView = FindWindowEx(hProgMan, NULL, "SHELLDLL_DefView", NULL);
HWND hSysListView = FindWindowEx(hDefView, NULL, "SysListView32", NULL);Nuri Ismail