Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <cstdlib>
- #include <windows.h>
- #include <winuser.h>
- #include <conio.h>
- #include <iostream>
- #include <tchar.h>
- using namespace std;
- /*
- 1 - success,
- 2 - info
- 3 - warning
- 4 - error
- */
- void writeLog(string message, int type = 2)
- {
- setlocale(LC_ALL, "Russian");
- HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
- INT color;
- switch (type)
- {
- case 1:
- color = 2;
- break;
- case 2:
- color = 1;
- break;
- case 3:
- color = 5;
- break;
- case 4:
- color = 4;
- break;
- }
- SetConsoleTextAttribute(handle, color);
- cout << message << endl;
- }
- int main ()
- {
- writeLog("Инициализация...");
- HWND elementClient = FindWindowA("ElementClient Window", NULL);
- HWND elementClient2 = FindWindowA("ElementClient Window", NULL);
- HWND activeWindow = GetActiveWindow();
- if (!elementClient)
- {
- writeLog("Окно клиента не найдено", 4);
- }
- while (elementClient != activeWindow)
- {
- writeLog("Окно клиента вне фокуса, возьмите окно в фокус", 3);
- Sleep(5000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement