Automating applications

Hello All,
I'm trying to write small console app that will:
1. find the window of my application (windows)
2. will change value of a textbox in that application (I don't want to use sendkeys).

Where should I begin? Thanks for any help :)
For me, the easiest way - to use PostMessage function:
1
2
3
4
5
6
7
8
9
10
11
12
13
void	main()
{
  HWND	hwnd;
  WPARAM	wParam;LPARAM	lParam;

  hwnd=FindWindow(NULL,"wB");
  if(hwnd!=NULL)
  {
    wParam=3;
    lParam=65;
    PostMessage(hwnd,WM_USER,wParam,lParam);
  }
}
, where "wB" is your application window name. You can use wParam as a control, and lParam as one character. In your application you should have something like:
1
2
3
4
5
6
7
8
9
void __fastcall TfmMain::HandleWMUser(TMessage Message)
{
  int	wparam,lparam;

  wparam=Message.WParam;
  lparam=Message.LParam;

  lblParams->Caption+=char(lparam);
}
closed account (48bpfSEw)
I can not tell you where you should begin but where you should end:

http://www.getautoma.com/


good luck! ^^
Looks impressive, but is rather expensive.
Topic archived. No new replies allowed.