Advertisement
Felanpro

Check Window

Mar 8th, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h> // This is needed for some reason, I think to get HWND.
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int x;
  9.     HWND test_window = FindWindowA(NULL, "Kalkylatorn"); /*Return NULL if the window wasn't found and return
  10.     1 if the window was found*/
  11.  
  12.     if(test_window)
  13.     {
  14.         cout << "The calculator is open." << endl;
  15.         cin >> x;
  16.     }
  17.     else
  18.     {
  19.         cout << "The calculator is not open." << endl;
  20.         cin >> x;
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement