Getting the handle of a child window while only knowing its ID

This is a discussion on Getting the handle of a child window while only knowing its ID within the Windows Programming forums, part of the Platform Specific Boards category; How do I the handle of a child window while only know its ID? I tried to type-cast with (HWND) ...

  1. #1
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052

    Getting the handle of a child window while only knowing its ID

    How do I the handle of a child window while only know its ID? I tried to type-cast with (HWND) but that didn't work...

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    If you know its parent window/dialog

    hWnd=GetDlgItem(hParent,ID);

    may work if it is a control.

    If it is a window or dialog you created I suggest storing the HWNDs in an array.
    Also create some #defines for the indexes.

    (I have a struct I store window data like HDC's, bitmaps ect in.)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting other processes class names
    By Hawkin in forum Windows Programming
    Replies: 3
    Last Post: 03-20-2008, 04:02 PM
  2. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 05:23 AM
  3. Posting a message to a child window
    By axr0284 in forum Windows Programming
    Replies: 6
    Last Post: 01-27-2005, 08:35 AM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 09:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21