I'm having difficultry trying to subclass the desktop. I've tried the following:
subClass.SubclassWindow(GetDesktopWindow()->m_hWnd);
subClass is a class that I've derived from CWnd to capture messages. Any help is appreciated.
Printable View
I'm having difficultry trying to subclass the desktop. I've tried the following:
subClass.SubclassWindow(GetDesktopWindow()->m_hWnd);
subClass is a class that I've derived from CWnd to capture messages. Any help is appreciated.
If you use Spy, you will see that the desktop is actually the a List Control("Program Manager"->SHELLDLL_DefView->SysListView32). You may want to subclass that one instead.
-Safai
Hello,
You mean I can subclass any window, even one that doesn't belongs to my application ? How to do this if I have handle (HWND) to this window ?
Regards,
Andris
This will not work since under WIN32, you cannot subclass windows belonging to other processess (SetWindowLong(...), used for actually performing the Subclassing will return zero when it detects that you are trying to subclass a window in another process). You must either use a Shell NameSpace extension or use system wide hook to get the shell to insert (inject) you (your dll) in shell's address space. then you can subclass the desktop.
Hope this helps.
Vali
I'm about 6 months into using Visual C++. Do you have, or do you know the location of an example of using Shell Namespaces? I've heard of namespaces, but have yet to use one. I appreciate the input.
One of the best books on the market for NameSpace / Shell extensions is:
Visual C++ Windows Shell Programming
By
Dan Esposito
Wrox Books
Please suggest me how to inject my system wide hook into shell dll.
Gupta.