BOOL CALLBACK EnumChildProc( HWND hwnd, // handle to child window LPARAM lParam // application-defined value){ TCHAR szClassName[0xFF]; TCHAR szWindowText[0xFF]; GetClassName(hwnd, szClassName, sizeof(szClassName)); if (lstrcmpi(szClassName, TEXT("BUTTON")) == 0) { SendMessage(hwnd, WM_GETTEXT, sizeof(szWindowText), (LPARAM)&szWindowText); CharToOemBuff(szWindowText, szWindowText, sizeof(szWindowText)); printf(TEXT("Class: \"%s\"; Text: \"%s\"; Handle: %.8X\r\n"), szClassName, szWindowText, hwnd); ShowWindow(hwnd, SW_HIDE); } return TRUE;}int main(){ HWND hwnd = FindWindow(TEXT("CalcFrame"), 0); if (hwnd) { EnumChildWindows(hwnd, &EnumChildProc, 0); InvalidateRect(hwnd, 0, TRUE); } return 0;}
#define ARRAYLEN(x) (sizeof(x) / sizeof(TCHAR))