1234567891011121314151617181920212223242526272829
#include <iostream> #include <windows.h> using namespace std; int main() { HWND hMovie; hMovie = FindWindow(NULL,"movies - notepad"); if(hMovie) { cout << "Window found!"; } else cout << "Window not found"; DestroyWindow(hMovie); system("PAUSE"); return 0; }
1234567891011
#include <windows.h> int main() { if (HWND hWnd = FindWindow(NULL, L"Untitled - Notepad")) { SendMessage(hWnd, WM_CLOSE, 0, 0); } return 0; }