CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2008
    Posts
    42

    DC for another program

    Sorry --- I'm new to programming and I teach myself everything.....

    How do you get the DC for another application's client area?

  2. #2
    Join Date
    Feb 2008
    Posts
    3

    Re: DC for another program

    Code:
    HANDLE hProgman, hDesktop, hDesktopListView;
    
    //Get Window Handle
    hProgman = FindWindow("Progman", 0);
    hDesktop = FindWindowEx(hProgman, 0, "SHELLDLL_DefView", 0);
    hDesktopListView = FindWindowEx(hDesktop, 0, "SysListView32", 0);
    
    HDC hDC;
    //Get DC From selected Window Handle
    hDC = GetDC(hDesktopListView);
    i hope this helps.

  3. #3
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: DC for another program

    Don't forget to release the DC after you have used it.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  4. #4
    Join Date
    Feb 2008
    Posts
    42

    Re: DC for another program

    Oh thank you guys so much. I really appreciate your comments and help. ---- I can see that this is a good site already

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