HWND hWnd = ::FindWindow(NULL, TEXT("MyWnd"));
if(hWnd != NULL) {
RECT rt;
if(::GetWindowRect(hWnd, &rt)) {
int x = rt.left + 100;
int y = rt.top + 100;
if(SetCursorPos(x, y)) {
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
}
}
if(hWnd != NULL) {
RECT rt;
if(::GetWindowRect(hWnd, &rt)) {
int x = rt.left + 100;
int y = rt.top + 100;
if(SetCursorPos(x, y)) {
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
}
}