Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // cetest.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <Windows.h>
- #include <iostream>
- #include <vector>
- #include <string>
- #include <locale>
- #include <codecvt>
- using namespace std;
- string ws2s(const std::wstring& wstr)
- {
- using convert_typeX = std::codecvt_utf8<wchar_t>;
- std::wstring_convert<convert_typeX, wchar_t> converterX;
- return converterX.to_bytes(wstr);
- }
- BOOL CALLBACK speichereFenster(HWND hwnd, LPARAM lParam) {
- const DWORD TITLE_SIZE = 1024;
- WCHAR windowTitle[TITLE_SIZE];
- GetWindowTextW(hwnd, windowTitle, TITLE_SIZE);
- int length = ::GetWindowTextLength(hwnd);
- wstring title_(&windowTitle[0]);
- string title = ws2s(title_);
- if (!IsWindowVisible(hwnd) || length == 0 || title == "Program Manager") {
- return TRUE;
- }
- std::vector<std::string>& titles =
- *reinterpret_cast<std::vector<std::string>*>(lParam);
- titles.push_back(title);
- return TRUE;
- }
- int main()
- {
- bool found = false;
- std::vector<std::string> titles;
- EnumWindows(speichereFenster, reinterpret_cast<LPARAM>(&titles));
- for (const auto& title : titles) {
- if (title.find("cheat engine")) found = true;
- cout << "Title: " << title << endl;
- }
- if (found != false) {
- cout << "Found" << endl;
- }
- else {
- cout << "None" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement