If window exists

I'm trying to have a project scan for a window, and if the window found then have the application kill itself. For some reason I can't get if Window working correctly. This is what I've got;
1
2
3
4
5
6
7
void Form1::Form1_Load.. {
HWND m_hWnd = FindWindowA("test", NULL);
	if( m_hWnd ) {
MessageBox:: Show ( "test has been detected running on this system","");
Close();
}
}
Last edited on
Since you are using .net, my guess is that you have the arguments to FindWindowA() backwards. I guess the caption of the window is "test", meaning it is the second argument, not the first.
Topic archived. No new replies allowed.