riaxe snippets
.NET
Console Application in C++ to get Window Titles
Dec 25th
Hi All, I am not a .net guy but compiled this useful script to get the open window titles.
==============================================
#include <windows.h>
#include <cstdio>
BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lparam)
{
HWND lShellWindow = GetShellWindow();
int& i = *(reinterpret_cast<int*>(lparam));
++i;
char title[256];
::GetWindowText(hwnd, title, sizeof(title));
if (hwnd == lShellWindow) return true;
if (!IsWindowVisible(hwnd)) return true;
int lLength = GetWindowTextLength(hwnd);
if (lLength == 0) return true;
::printf(title);
::printf(“\n”);
return TRUE;
}
int main()
{
int i = 0;
::EnumWindows(&MyEnumWindowsProc, reinterpret_cast<LPARAM>(&i));
return 0;
}
========================================
Hope this helps