Hello im creating program that check for opened window name but at the moment it check it like 100 times per second and i want to check it every time the window change.I know its propably becasue of infinity loop.But im new in C++ and i have no idea how to do it, can someone help me ?
char wnd_title[256];
while(1) {
HWND hwnd=GetForegroundWindow();
GetWindowText(hwnd,wnd_title,sizeof(wnd_title));
cout << wnd_title;
}
Best regards.