Guest User

Untitled

a guest
Aug 1st, 2015
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. // Win32Console.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <fstream>
  7.  
  8. BOOL CALLBACK enumWindowsHandler(HWND hWnd, LPARAM lParam)
  9. {
  10.     if (!IsWindow(hWnd)) {
  11.         return false;
  12.     }
  13.  
  14.     wchar_t title[250];
  15.  
  16.     GetWindowText(hWnd, title, sizeof(title));
  17.    
  18.     int result = wcscmp(title, L"Калькулятор");
  19.    
  20.     if (result == 0) {
  21.         wprintf(L"%s", title);
  22.         *lParam = hWnd;
  23.     }
  24.  
  25.     return true;
  26. }
  27.  
  28. int main()
  29. {
  30.     // Set locale
  31.     std::locale::global(std::locale("Russian_Russia"));
  32.     HWND hwnd;
  33.  
  34.     EnumWindows(enumWindowsHandler, (LPARAM)&hwnd);
  35.  
  36.     Sleep(1000 * 100);
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment