4 static HWND gForground;
6 BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lp)
8 TCHAR strWindowText[1024];
9 GetWindowText(hwnd, strWindowText, 1024);
11 TCHAR strWindowClass[1024];
12 GetClassName(hwnd, strWindowClass, 1024);
15 GetWindowRect(hwnd, &rc);
17 printf("%s (%s) %d %d %d %d", strWindowClass, strWindowText, rc.left, rc.right, rc.top, rc.bottom);
19 if(hwnd == gForground) {
28 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
29 PSTR lpCmdLine, int nCmdShow)
31 gForground = GetForegroundWindow();
33 EnumWindows(EnumWindowsProc, 0);