Thread: Get a window handle for control of other program

  1. #1
    Registered User Kirdra's Avatar
    Join Date
    Aug 2002
    Posts
    105

    Get a window handle for control of other program

    I'm trying to make a little program that will fill out my account information on another program, because I can't be bothered to type it out every time.

    So here is what I am trying to do, get window handles for 2 edit boxes that are in another application window so I can set the text.

  2. #2
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    FindWindow()
    If you know the title. There are other ways, depending what information you have on the already open window

  3. #3
    Registered User Kirdra's Avatar
    Join Date
    Aug 2002
    Posts
    105
    I think I found my answer, dunno till I try it out, FindWindowEx is used for this purpose I am reading. FindWindow doesn.t work to get the child control handles.

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    319
    what i do is use WindowFromPoint then you can use GetClassName or GetWindowText ,

    Code:
    #include <windows.h>
    #include <stdio.h>
    
    int main()
    {
    	POINT point;
    	char ClassName[32];
    	char WindowText[32];
    
    	while(1)
    	{
    	GetCursorPos(&point);
    	HWND hWnd = WindowFromPoint(point);
    	GetClassName(hWnd,ClassName,sizeof(ClassName));
    	GetWindowText(hWnd,WindowText,sizeof(WindowText));
        printf("%s %s \n",ClassName , WindowText);
    	}
    	return 0;
    }
    Last edited by Anddos; 01-10-2009 at 09:03 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Adding buttons, edit boxes, etc to the window
    By rainmanddw in forum Windows Programming
    Replies: 1
    Last Post: 04-10-2006, 03:07 PM
  3. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  4. Problem with creating new window, from another window
    By Garfield in forum Windows Programming
    Replies: 6
    Last Post: 01-11-2004, 02:10 PM
  5. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM