Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Get the handle to the Desktop and try to show it.

$
0
0

Hi, I just want to know what's wrong with my code. All of the Handles returned by the API functions are all "unused" according to the debugger and with the help of breakpoints. I just want to get a valid handle to the Desktop and then show it. You can refer to Raymond Chen's "Windows Confidential: Leftovers from Windows 3.0" article to see what I mean.

Thank you very much.

void ShowDesktop()
	{
		// Refer to Raymond Chen's "Windows Confidential: Leftovers from Windows 3.0"

		HWND hRealDesktopWindow = GetDesktopWindow();
		HWND hExplorerDesktopWindow;
		HWND hExplorerDesktopWindowListview;
		hRealDesktopWindow = GetShellWindow(); // Get the handle to the "real" desktop. 
		hExplorerDesktopWindow = FindWindowEx(hRealDesktopWindow, NULL, L"SHELLDLL_DefView", NULL); // Get th handle to the "explorer" Desktop.
		hExplorerDesktopWindowListview = FindWindowEx(hExplorerDesktopWindow, NULL, L"SysListView32", L"FolderView"); // Get the layer after the "explorer" desktop, where the icons are.
		ShowWindow(hExplorerDesktopWindowListview, SW_SHOW);
	}


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>