Thread: Finding window with coordinates

  1. #1
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227

    Finding window with coordinates

    If you had the coordinates of a certain widow, how would you get the handle?

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    By getting the handles for all windows and checking whether the co-ordinates match for each one in turn??

  3. #3
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    I thought of that, but I was just wondering if there was an easier approach. Oh well, guess that's good enough

    Thanks anyways.

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Would 'WindowFromPoint' be what you are after?:

    POINT pt; //set to coords eg mouse coord
    HWND hWnd=WindowFromPoint(&pt);

    There's also a fn 'ChildWindowFromPoint' that may also be of interest.

  5. #5
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    Now THAT's what I'm talkin' 'bout. Thanks a heap, ken.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM