Sure hope your still around Ancient Dragon your a life saver, and a great teacher
What I'm after-->I am trying to send a message to a button on the parent window--
Ok here's my problem. I am trying to automate an install for various applications.
For my first automation process. I am installing Lumension a security package.
The first window appears and it's title is "Lumension Security Client".
So I set an HWND to the title like so HWND Lumension = FindWindows(0,"Lumension Security Client");
I created a device context HDC Ldc = GetDC(Lumension);
I can paint to the program using setpixel, and if I send Lumension a WM_CLOSE message it will close out.
I downloaded winID to try and help myself out even though I'm a bit clueless to using WinID but know it's similar to spy++.
Since I know the HWND to the Lumension window ... how can I send a key to the button.
When I spy++ the button it's title is "&Next >" so I tried setting an HWND button1 = FindWindow(0,"&Next >");
Then tried sending SendMessage(button1,WM_KEYDOWN,VK_SPACE,0); but nothing happens.
I'll post some code, but any help on how this winID(Spy++ like program) can help me do this would be great.
I also tried broadcasting VK_SPACE to all windows etc.. nothings working!
Operating system: Windows 7 Enterprise edition 64bit OS
here is my install lumension function.
int InstallLumension()
{
//Map drive A for automation
system("net use a: \"\\\\172.19.34.33\\software dumps\\balaji\\altrix\" /PERSISTENT:YES && exit");
system("start a:\\Lumension\\4.4.1003NoAddRemove\\setup.exe && exit");
Sleep(15000);
HWND Lumension = FindWindow(0,"Lumension Endpoint Security Client");
HWND Lb1 = FindWindow(0,"&Next >");
if(Lumension == 0)
{
MessageBox(0,
"Lumension Handle Error",
"Lumension HWND not defined",
MB_ICONINFORMATION);
};
//SendMessage(Lumension,WM_CLOSE,0,0);
MessageBox(0,
"Testing Lumension Closed",
"Close",
MB_ICONINFORMATION);
//Create Device Context\Brush to paint color zone in for automation troubleshooting
HDC LumDC = GetDC(Lumension);
int mousePosX;
int mousePosY;
SetFocus(Lumension);
SetWindowPos(Lumension,HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
Sleep(200);
SendMessage(Lb1,WM_KEYDOWN,VK_SPACE,0);
Sleep(200);
SendMessage(Lb1,WM_KEYUP,VK_SPACE,0);
//for(;;)
// {
for(mousePosY = 330; mousePosY <= 335;mousePosY++)
{
for(mousePosX = 320; mousePosX <= 330; mousePosX++)
{
SetPixel(LumDC,mousePosX,mousePosY,redzone);
SendMessage(Lumension,WM_LBUTTONDBLCLK,0, MAKELPARAM(mousePosX, mousePosY));
};
}
PostMessage(HWND_BROADCAST,WM_KEYDOWN,0x20,0);
PostMessage(HWND_BROADCAST,WM_KEYUP,0x20,0);
// }// end forever loop
Sleep(300);
PostMessage(Lumension,WM_KEYDOWN,0x20,0);
PostMessage(Lumension,WM_KEYUP,0x20,0);
Sleep(300);
//SendMessage(Lumension,WM_LBUTTONDBLCLK,0, MAKELPARAM(mousePosX, mousePosY));
return 0;
};