Thank you for this information, you are pointing me in the right direction. I have a small test script and I am using with FindWindow() and SendMessage(). I am able to find the window, but cannot seem to send a message to the window with the SendMessage() function.
Here is the code:
Code:
#include <windows.h>
#include <string>
#include <iostream>
int main()
{
std::string strGooglePath = "http://www.google.com";
ShellExecute(0,"open",strGooglePath.c_str(),0,0,SW_SHOW);
Sleep(5000);
HWND OpenGoogle = FindWindow(0, "Google - Microsoft Internet Explorer");
if(OpenGoogle != NULL)
SendMessage(OpenGoogle, WM_CLOSE, 0, 0);
else
std::cout << "Could not locate window" << std::endl;
return 0;
}
Just for test purposes, I wanted to find the window, then close it. I have tested the code with:
if(OpenGoogle != NULL)
std::cout << "Found the window" << std::endl;
else
std::cout << "Could not locate window" << std::endl;
"Found the window" is displayed. I seem to be having a problem with the SendMessage() function. Do you notice anything that I am doing wrong?
Thanks for your help Fordy.