Thread: Locating A Window Handle For...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    265

    Locating A Window Handle For...

    How do i go about locating the window handle for the window that is on top. It doesnt necessarily have focus, however its the "top" window. If i have 10 windows open, one of them is going to be considered on the top of the pile and not overlapped by any other windows. Thanks for your time guys.

  2. #2
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Lightbulb Suggestion :)

    I think you are looking for the GetWindowLong() function. I can't think of the parameters right now, but you can check http://msdn.microsoft.com/library/ and search for it. I believe it has a parameter for finding the top window.

  3. #3
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    or GetTopWindow(NULL);
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  4. #4
    Registered User
    Join Date
    Feb 2003
    Posts
    265
    Ill give them a shot, thanks for the replys guys.

  5. #5
    Registered User
    Join Date
    Feb 2003
    Posts
    265
    FYB, when I try to max the hwnd returned by GetTopWindow it crashes explorer, as per another thread. Any thoughts on what window its trying to return, like is it returning the hwnd for the desktop or start menu or something weird that shouldnt be maximized? Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with setting text into LTEXT using Window Handle
    By jasperleeabc in forum Windows Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 08:14 AM
  3. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  4. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  5. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM