I am trying to build 2 test programs that use the SetFocus and FindWindow function. I will post the sample code below. It does not seem to be swapping focus. Is there something in my code that needs to change????????
main1.c
Code:
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
system("start main2.exe");
system("PAUSE");
SetFocus(FindWindow(NULL,"F:\\Dev-Cpp\\Code\\Test Focus\\Main2.exe"));
system("PAUSE");
return 0;
}
Main2.c
Code:
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
system("PAUSE");
SetFocus(FindWindow(NULL,"F:\\Dev-Cpp\\Code\\Test Focus\\main1.exe"));
system("PAUSE");
SetFocus(FindWindow(NULL,"F:\\Dev-Cpp\\Code\\Test Focus\\main1.exe"));
return 0;
}
Any Suggestions???????
Thanks,
Kendal