static BOOL CALLBACK enumWindowCallback(HWND func_hWnd, LPARAM lparam) {
int length = GetWindowTextLength(func_hWnd);
TCHAR* buffer;
char* buffer = new char[length + 1];
GetWindowText(hWnd, buffer, length + 1);
string windowTitle(buffer);
if (length != 0) {
std::cout << func_hWnd << ": " << windowTitle << std::endl;
}
return TRUE;
}
#include <windows.h>
#include <iostream>
#include <string>
static BOOL CALLBACK enumWindowCallback(HWND hwnd, LPARAM lparam) {
int length = GetWindowTextLength(hwnd);
TCHAR* buffer = new TCHAR[length + 1];
GetWindowText(hwnd, buffer, length + 1);
std::wstring windowTitle(buffer);
if (length != 0) {
std::wcout << hwnd << ": " << windowTitle << std::endl;
}
return TRUE;
}