#define STRICT #define WIN32_LEAN_AND_MEAN #include #include #include #include "enumw.h" #define IDC_LIST 500 static OLDFONTENUMPROC lpfnEnumFonts; static WNDENUMPROC lpfnEnumWindows; static FONTENUMPROC lpfnEnumFontFam; static char szAppname[]="enumw"; static HWND hWindow; static HWND hListWnd; static HINSTANCE hInstance; LOGFONT logFont = { 12, 0, NULL, NULL, 400, FALSE, FALSE, FALSE, OEM_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "" }; char * font_name = & logFont.lfFaceName; int CALLBACK EnumFontsProc ( const LOGFONT * lpFont, const TEXTMETRIC * lpTM, int style, LPARAM str) { if (lpTM->tmPitchAndFamily & TMPF_FIXED_PITCH) SendMessage(hListWnd, LB_ADDSTRING, 0, (LPARAM) lpFont->lfFaceName); return 1; } RETURN_CALLBACK(4); int CALLBACK EnumFontFamProc ( const ENUMLOGFONT *lpFont, const NEWTEXTMETRIC *lpTM, int type, LPARAM str) { if (type & TRUETYPE_FONTTYPE) SendMessage(hListWnd, LB_ADDSTRING, 0, (LPARAM)lpFont->elfFullName); return 1; } RETURN_CALLBACK(4); void display_window(HWND hWnd, int level) { static char text[256]; static char class[256]; RECT r; char *buf; int i; buf = text; for (i=0; i<(int)level; i++) { *buf++ = ' '; *buf++ = ' '; *buf++ = ' '; *buf++ = ' '; } sprintf(buf, "%04X ", hWnd); buf = text + strlen(text); if (GetClassName(hWnd, class, 256)) { sprintf(buf, "[%s] ", class); buf = text + strlen(text); } GetWindowRect(hWnd, &r); sprintf(buf, "(%d,%d,%d,%d) ", r.left, r.top, r.right, r.bottom); buf = text + strlen(text); if (GetWindowText(hWnd, class, 256)) { sprintf(buf, "<%s>", class); buf = text + strlen(text); } if (level == 0) { HINSTANCE hInst = (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE); if (GetModuleFileName(hInst, class, 256)) sprintf(buf," %s", class); } /* we must convert 32bit flat pointer to 16bit far pointer */ SendMessage(hListWnd, LB_ADDSTRING, 0, (LPARAM)text); } BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM level) { static HWND seen[1024] = {0}; HWND *ps; int i; static int num_wnd = 0; /* cheap check for duplicates */ for (i=0, ps=seen; i