Code:
//---------------------------------------------------------------------------
#include <process.h>
#include <stdlib.h>
#include <time.h>
#include <vcl.h>
#include <Windows.h>
#pragma hdrstop
#include "my_IP_suite.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
//const char *appPath = "C:\\Program Files\\My IP Suite\\MyIPSuite.exe";
//execl(appPath, appPath, NULL);
HWND hWnd; //window handle
HWND hBut; //control handle
// get handle of Reminder window
hWnd = FindWindow(NULL, "Reminder");
if(! hWnd) exit(0); //if window don't found, exit program
//move through controls, get handle of command button
hBut = FindWindowEx(hWnd, NULL, "TButton", NULL);
hBut = FindWindowEx(hWnd, hBut, "TButton", NULL);
//click command button
PostMessage(hBut, BM_CLICK, NULL, NULL);
//get title of Options window
hWnd = FindWindow(NULL, "Options");
char buff[] = "HOI";
if(! hWnd) exit(0); //if window don't found, exit program
//move through controls, get handle of edit box
hBut = FindWindowEx(hWnd, NULL, "TButton", NULL);
hBut = FindWindowEx(hWnd, hBut, "TButton", NULL);
hBut = FindWindowEx(hWnd, hBut, "TEdit", NULL);
hBut = FindWindowEx(hWnd, hBut, "TEdit", NULL);
hBut = FindWindowEx(hWnd, hBut, "TEdit", NULL);
PostMessage(hBut, WM_SETTEXT, NULL, (LPARAM)(LPCTSTR)"hey");
//PostMessage(hBut, WM_SETTEXT, 0, (LPARAM)(LPCTSTR)"HI");
//::SetFocus(hBut);
//SetWindowText(hBut, buff);
}
//---------------------------------------------------------------------------