ReactOS 0.4.15-dev-7934-g1dc8d80
guithreadinfo.c
Go to the documentation of this file.
1#include <windows.h>
2#include <stdio.h>
3#include <string.h>
4
6//HFONT tf;
8
9int WINAPI
11 HINSTANCE hPrevInstance,
12 LPSTR lpszCmdLine,
13 int nCmdShow)
14{
15 WNDCLASS wc;
16 MSG msg;
17 HWND hWnd;
18
19 wc.lpszClassName = "GuiThreadInfoClass";
26 wc.lpszMenuName = NULL;
27 wc.cbClsExtra = 0;
28 wc.cbWndExtra = 0;
29 if (RegisterClass(&wc) == 0)
30 {
31 fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n",
32 GetLastError());
33 return(1);
34 }
35
36 hWnd = CreateWindow("GuiThreadInfoClass",
37 "GetGUIThreadInfo",
39 0,
40 0,
43 NULL,
44 NULL,
46 NULL);
47 if (hWnd == NULL)
48 {
49 fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n",
50 GetLastError());
51 return(1);
52 }
53
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");
57
58 gti.cbSize = sizeof(GUITHREADINFO);
60
61 SetTimer(hWnd, 1, 1000, NULL);
62 ShowWindow(hWnd, nCmdShow);
63
64 while(GetMessage(&msg, NULL, 0, 0))
65 {
68 }
69
70 //DeleteObject(tf);
71
72 return msg.wParam;
73}
74
76{
77 PAINTSTRUCT ps;
78 HDC hDC;
79 char str[255];
80
81 switch(msg)
82 {
83
84 case WM_PAINT:
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));
94
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));
109
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));
116 EndPaint(hWnd, &ps);
117 break;
118
119 case WM_TIMER:
122 break;
123
124 case WM_DESTROY:
126 break;
127
128 default:
130 }
131 return 0;
132}
static HDC hDC
Definition: 3dtext.c:33
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define GetCurrentProcess()
Definition: compat.h:759
#define CALLBACK
Definition: compat.h:35
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
Definition: guithreadinfo.c:10
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM)
Definition: guithreadinfo.c:75
static GUITHREADINFO gti
Definition: guithreadinfo.c:5
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static HDC
Definition: imagelist.c:92
unsigned int UINT
Definition: ndis.h:50
EXTINLINE DWORD WINAPI GetGuiResources(HANDLE hProcess, DWORD uiFlags)
Definition: ntwrapper.h:64
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
#define DefWindowProc
Definition: ros2win.h:31
const WCHAR * str
HBRUSH hbrBackground
Definition: winuser.h:3170
HICON hIcon
Definition: winuser.h:3168
HINSTANCE hInstance
Definition: winuser.h:3167
HCURSOR hCursor
Definition: winuser.h:3169
int cbWndExtra
Definition: winuser.h:3166
UINT style
Definition: winuser.h:3163
LPCSTR lpszMenuName
Definition: winuser.h:3171
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
int cbClsExtra
Definition: winuser.h:3165
HWND hwndCaret
Definition: winable.h:77
HWND hwndFocus
Definition: winable.h:73
HWND hwndMenuOwner
Definition: winable.h:75
HWND hwndMoveSize
Definition: winable.h:76
DWORD cbSize
Definition: winable.h:70
HWND hwndCapture
Definition: winable.h:74
HWND hwndActive
Definition: winable.h:72
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define GUI_POPUPMENUMODE
Definition: winable.h:31
struct tagGUITHREADINFO GUITHREADINFO
#define GUI_SYSTEMMENUMODE
Definition: winable.h:30
#define GUI_INMENUMODE
Definition: winable.h:29
#define GUI_CARETBLINKING
Definition: winable.h:27
#define GUI_INMOVESIZE
Definition: winable.h:28
BOOL WINAPI GetGUIThreadInfo(DWORD, LPGUITHREADINFO)
Definition: ntwrapper.h:398
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define lstrcat
Definition: winbase.h:3871
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define GRAY_BRUSH
Definition: wingdi.h:898
#define TextOut
Definition: wingdi.h:4483
#define WM_PAINT
Definition: winuser.h:1620
#define CS_VREDRAW
Definition: winuser.h:658
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define IDI_APPLICATION
Definition: winuser.h:704
#define CreateWindow
Definition: winuser.h:5754
#define GetMessage
Definition: winuser.h:5790
#define WM_TIMER
Definition: winuser.h:1742
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define LoadIcon
Definition: winuser.h:5813
#define LoadCursor
Definition: winuser.h:5812
#define wsprintf
Definition: winuser.h:5865
#define CW_USEDEFAULT
Definition: winuser.h:225
#define RegisterClass
Definition: winuser.h:5836
#define WM_DESTROY
Definition: winuser.h:1609
#define DispatchMessage
Definition: winuser.h:5765
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
char * LPSTR
Definition: xmlstorage.h:182
const CHAR * LPCTSTR
Definition: xmlstorage.h:193