SHARE
TWEET

Untitled

a guest Jun 18th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <cstdlib>
  3. #include <windows.h>
  4. #include <winuser.h>
  5. #include <conio.h>
  6. #include <iostream>
  7. #include <tchar.h>
  8.  
  9. using namespace std;
  10.  
  11. /*
  12.     1 - success,
  13.     2 - info
  14.     3 - warning
  15.     4 - error
  16. */
  17. void writeLog(string message, int type = 2)
  18. {
  19.     setlocale(LC_ALL, "Russian");
  20.  
  21.     HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
  22.     INT color;
  23.    
  24.     switch (type)
  25.     {
  26.         case 1:
  27.             color = 2;
  28.             break;
  29.  
  30.         case 2:
  31.             color = 1;
  32.             break;
  33.  
  34.         case 3:
  35.             color = 5;
  36.             break;
  37.  
  38.         case 4:
  39.             color = 4;
  40.             break;
  41.     }
  42.  
  43.     SetConsoleTextAttribute(handle, color);
  44.  
  45.     cout << message << endl;
  46. }
  47.  
  48. int main ()
  49. {
  50.     writeLog("Инициализация...");
  51.  
  52.     HWND elementClient = FindWindowA("ElementClient Window", NULL);
  53.     HWND elementClient2 = FindWindowA("ElementClient Window", NULL);
  54.     HWND activeWindow  = GetActiveWindow();
  55.  
  56.     if (!elementClient)
  57.     {
  58.         writeLog("Окно клиента не найдено", 4);
  59.     }
  60.  
  61.     while (elementClient != activeWindow)
  62.     {
  63.         writeLog("Окно клиента вне фокуса, возьмите окно в фокус", 3);
  64.         Sleep(5000);
  65.     }
  66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top