5 static GUITHREADINFO gti
;
7 LRESULT WINAPI
MainWndProc(HWND
, UINT
, WPARAM
, LPARAM
);
10 WinMain(HINSTANCE hInstance
,
11 HINSTANCE hPrevInstance
,
19 wc
.lpszClassName
= "GuiThreadInfoClass";
20 wc
.lpfnWndProc
= MainWndProc
;
21 wc
.style
= CS_VREDRAW
| CS_HREDRAW
;
22 wc
.hInstance
= hInstance
;
23 wc
.hIcon
= LoadIcon(NULL
, (LPCTSTR
)IDI_APPLICATION
);
24 wc
.hCursor
= LoadCursor(NULL
, (LPCTSTR
)IDC_ARROW
);
25 wc
.hbrBackground
= (HBRUSH
)GetStockObject(GRAY_BRUSH
);
26 wc
.lpszMenuName
= NULL
;
29 if (RegisterClass(&wc
) == 0)
31 fprintf(stderr
, "RegisterClass failed (last error 0x%lX)\n",
36 hWnd
= CreateWindow("GuiThreadInfoClass",
38 WS_OVERLAPPEDWINDOW
|WS_HSCROLL
|WS_VSCROLL
,
49 fprintf(stderr
, "CreateWindow failed (last error 0x%lX)\n",
54 //tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE,
55 // ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
56 // DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons");
58 gti
.cbSize
= sizeof(GUITHREADINFO
);
59 GetGUIThreadInfo(0, >i
);
61 SetTimer(hWnd
, 1, 1000, NULL
);
62 ShowWindow(hWnd
, nCmdShow
);
64 while(GetMessage(&msg
, NULL
, 0, 0))
66 TranslateMessage(&msg
);
67 DispatchMessage(&msg
);
75 LRESULT CALLBACK
MainWndProc(HWND hWnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
85 hDC
= BeginPaint(hWnd
, &ps
);
86 wsprintf(str
, "flags: ");
87 if(gti
.flags
& GUI_16BITTASK
) lstrcat(str
, "GUI_16BITTASK ");
88 if(gti
.flags
& GUI_CARETBLINKING
) lstrcat(str
, "GUI_CARETBLINKING ");
89 if(gti
.flags
& GUI_INMENUMODE
) lstrcat(str
, "GUI_INMENUMODE ");
90 if(gti
.flags
& GUI_INMOVESIZE
) lstrcat(str
, "GUI_INMOVESIZE ");
91 if(gti
.flags
& GUI_POPUPMENUMODE
) lstrcat(str
, "GUI_POPUPMENUMODE ");
92 if(gti
.flags
& GUI_SYSTEMMENUMODE
) lstrcat(str
, "GUI_SYSTEMMENUMODE ");
93 TextOut(hDC
, 10, 10, str
, strlen(str
));
95 wsprintf(str
, "hwndActive == %08X", gti
.hwndActive
);
96 TextOut(hDC
, 10, 30, str
, strlen(str
));
97 wsprintf(str
, "hwndFocus == %08X", gti
.hwndFocus
);
98 TextOut(hDC
, 10, 50, str
, strlen(str
));
99 wsprintf(str
, "hwndCapture == %08X", gti
.hwndCapture
);
100 TextOut(hDC
, 10, 70, str
, strlen(str
));
101 wsprintf(str
, "hwndMenuOwner == %08X", gti
.hwndMenuOwner
);
102 TextOut(hDC
, 10, 90, str
, strlen(str
));
103 wsprintf(str
, "hwndMoveSize == %08X", gti
.hwndMoveSize
);
104 TextOut(hDC
, 10, 110, str
, strlen(str
));
105 wsprintf(str
, "hwndCaret == %08X", gti
.hwndCaret
);
106 TextOut(hDC
, 10, 130, str
, strlen(str
));
107 wsprintf(str
, "rcCaret == (%lu, %lu, %lu, %lu)", gti
.rcCaret
.left
, gti
.rcCaret
.top
, gti
.rcCaret
.right
, gti
.rcCaret
.bottom
);
108 TextOut(hDC
, 10, 150, str
, strlen(str
));
110 wsprintf(str
, "GetGuiResources for the current process: %08X", GetCurrentProcess());
111 TextOut(hDC
, 10, 180, str
, strlen(str
));
112 wsprintf(str
, "GetGuiResources: GR_GDIOBJECTS == %04X", GetGuiResources(GetCurrentProcess(), GR_GDIOBJECTS
));
113 TextOut(hDC
, 10, 200, str
, strlen(str
));
114 wsprintf(str
, "GetGuiResources: GR_USEROBJECTS == %04x", GetGuiResources(GetCurrentProcess(), GR_USEROBJECTS
));
115 TextOut(hDC
, 10, 220, str
, strlen(str
));
120 GetGUIThreadInfo(0, >i
);
121 InvalidateRect(hWnd
, NULL
, TRUE
);
129 return DefWindowProc(hWnd
, msg
, wParam
, lParam
);