Advertisement
Guest User

Untitled

a guest
Dec 30th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // cetest.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <Windows.h>
  6. #include <iostream>
  7. #include <vector>
  8. #include <string>
  9. #include <locale>
  10. #include <codecvt>
  11.  
  12. using namespace std;
  13.  
  14. string ws2s(const std::wstring& wstr)
  15. {
  16.     using convert_typeX = std::codecvt_utf8<wchar_t>;
  17.     std::wstring_convert<convert_typeX, wchar_t> converterX;
  18.  
  19.     return converterX.to_bytes(wstr);
  20. }
  21.  
  22. BOOL CALLBACK speichereFenster(HWND hwnd, LPARAM lParam) {
  23.     const DWORD TITLE_SIZE = 1024;
  24.     WCHAR windowTitle[TITLE_SIZE];
  25.  
  26.     GetWindowTextW(hwnd, windowTitle, TITLE_SIZE);
  27.  
  28.     int length = ::GetWindowTextLength(hwnd);
  29.     wstring title_(&windowTitle[0]);
  30.     string title = ws2s(title_);
  31.    
  32.     if (!IsWindowVisible(hwnd) || length == 0 || title == "Program Manager") {
  33.         return TRUE;
  34.     }
  35.  
  36.     std::vector<std::string>& titles =
  37.         *reinterpret_cast<std::vector<std::string>*>(lParam);
  38.     titles.push_back(title);
  39.  
  40.     return TRUE;
  41. }
  42.  
  43. int main()
  44. {
  45.     bool found = false;
  46.     std::vector<std::string> titles;
  47.     EnumWindows(speichereFenster, reinterpret_cast<LPARAM>(&titles));
  48.  
  49.     for (const auto& title : titles) {
  50.         if (title.find("cheat engine")) found = true;
  51.         cout << "Title: " << title << endl;
  52.     }
  53.  
  54.     if (found != false) {
  55.         cout << "Found" << endl;
  56.     }
  57.     else {
  58.         cout << "None" << endl;
  59.     }
  60.    
  61.     return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement