Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. WindowFromDC

WindowFromDC

Scheduled Pinned Locked Moved Windows API
question
3 Posts 3 Posters 11 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    navarromoral
    wrote on last edited by
    #1

    Hello all! I am trying to determine if a HDC points to the desktop. To do that I use WindowFromDC() which works fine under XP but returns 0 under Vista/7. Is there any way to determine it using some other method?? Thank you all very much!!

    S V 2 Replies Last reply
    0
    • N navarromoral

      Hello all! I am trying to determine if a HDC points to the desktop. To do that I use WindowFromDC() which works fine under XP but returns 0 under Vista/7. Is there any way to determine it using some other method?? Thank you all very much!!

      S Offline
      S Offline
      Santhosh G_
      wrote on last edited by
      #2

      In windows 7, WindowFromDC() works fine. Following code gives Desktop window handle.

      HDC hDcDesktop = ::GetDC(0);
      
      HWND hWindowDesktop1 = ::WindowFromDC(hDcDesktop);
      

      How you are getting the DC to Desktop ?

      1 Reply Last reply
      0
      • N navarromoral

        Hello all! I am trying to determine if a HDC points to the desktop. To do that I use WindowFromDC() which works fine under XP but returns 0 under Vista/7. Is there any way to determine it using some other method?? Thank you all very much!!

        V Offline
        V Offline
        val_melamed
        wrote on last edited by
        #3

        To get the desktop window handle I use the GetDesktopWindow function.

        HWND hwndDesktop = GetDesktopWindow()

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups