CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 1999
    Location
    Beaverton, OR
    Posts
    241

    How do I subclass the desktop?

    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.


  2. #2
    Join Date
    May 1999
    Location
    Toronto, Ontario, Canada
    Posts
    155

    Re: How do I subclass the desktop?

    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

  3. #3
    Join Date
    May 1999
    Location
    Latvia
    Posts
    30

    Re: How do I subclass the desktop?

    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


  4. #4
    Join Date
    May 1999
    Location
    Houston
    Posts
    21

    Re: How do I subclass the desktop?

    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


  5. #5
    Join Date
    Apr 1999
    Location
    Beaverton, OR
    Posts
    241

    Re: How do I subclass the desktop?

    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.


  6. #6
    Join Date
    May 1999
    Location
    Houston
    Posts
    21

    Re: How do I subclass the desktop?

    One of the best books on the market for NameSpace / Shell extensions is:

    Visual C++ Windows Shell Programming
    By
    Dan Esposito
    Wrox Books


  7. #7
    Join Date
    Jan 2002
    Posts
    298

    Re: How do I subclass the desktop?

    Please suggest me how to inject my system wide hook into shell dll.
    Gupta.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured