ReactOS 0.4.15-dev-7788-g1ad9096
icontest.c File Reference
#include <windows.h>
#include "resource.h"
#include <string.h>
#include <stdio.h>
Include dependency graph for icontest.c:

Go to the source code of this file.

Functions

ULONG __cdecl DbgPrint (IN PCH Format, IN ...)
 
LRESULT WINAPI MainWndProc (HWND, UINT, WPARAM, LPARAM)
 
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
 

Variables

const char titleDrwIco [] = "DrawIcon Output"
 
const char titleMask [] = "Mask(AND image)"
 
const char titleXor [] = "XOR(color image)"
 
const char file [] = "Icon from file:"
 
const char res [] = "Icon from Resource:"
 
const char cursor [] = "Current Cursor:"
 
const char cursormask [] = "Cursor Mask Bitmap"
 
const char cursorcolor [] = "Cursor Color Bitmap"
 
HFONT tf
 
HINSTANCE hInst
 

Function Documentation

◆ DbgPrint()

ULONG __cdecl DbgPrint ( IN PCH  Format,
IN ...   
)

◆ MainWndProc()

LRESULT WINAPI MainWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 88 of file icontest.c.

89{
90 PAINTSTRUCT ps;
91 HDC hDC;
93 HGDIOBJ hOld;
94 HDC hMemDC;
95 CURSORINFO cursorinfo;
96 ICONINFO iconinfo;
97 BITMAP bmp;
98 RECT rc;
99 CHAR str[20];
100
101 switch(msg)
102 {
103 case WM_PAINT:
104 hDC = BeginPaint(hWnd, &ps);
107
108 TextOut(hDC, 160, 10, file, strlen(file));
110 TextOut(hDC, 160, 85, titleMask, strlen(titleMask));
111 TextOut(hDC, 300, 85, titleXor, strlen(titleXor));
112
114 DrawIcon(hDC,50,50,hIcon);
115
116 hMemDC = CreateCompatibleDC(hDC);
117 GetIconInfo(hIcon, &iconinfo);
119
120 hOld = SelectObject(hMemDC, iconinfo.hbmMask);
121 BitBlt(hDC, 200, 50, 32, 32, hMemDC, 0, 0, SRCCOPY);
122 SelectObject(hMemDC, iconinfo.hbmColor);
123 BitBlt(hDC, 350, 50, 32, 32, hMemDC, 0, 0, SRCCOPY);
124
125 DeleteObject(iconinfo.hbmMask);
126 DeleteObject(iconinfo.hbmColor);
127
128 TextOut(hDC, 145, 150, res, strlen(res));
130 TextOut(hDC, 160, 225, titleMask, strlen(titleMask));
131 TextOut(hDC, 300, 225, titleXor, strlen(titleXor));
132
134 DrawIcon(hDC,50,190,hIcon);
135
136 GetIconInfo(hIcon, &iconinfo);
138
139 SelectObject(hMemDC, iconinfo.hbmMask);
140 BitBlt(hDC, 200, 190, 32, 32, hMemDC, 0, 0, SRCCOPY);
141 SelectObject(hMemDC, iconinfo.hbmColor);
142 BitBlt(hDC, 350, 190, 32, 32, hMemDC, 0, 0, SRCCOPY);
143
144 DeleteObject(iconinfo.hbmMask);
145 DeleteObject(iconinfo.hbmColor);
146
147 cursorinfo.cbSize = sizeof(CURSORINFO);
148 if(GetCursorInfo(&cursorinfo))
149 {
150 if(cursorinfo.hCursor && cursorinfo.flags)
151 {
152 TextOut(hDC, 160, 290, cursor, strlen(cursor));
153 DrawIcon(hDC, 50, 330, cursorinfo.hCursor);
154 GetIconInfo(cursorinfo.hCursor, &iconinfo);
156
157 sprintf(str, "Hotspot: %ld; %ld", iconinfo.xHotspot, iconinfo.yHotspot);
158 TextOut(hDC, 15, 380, str, strlen(str));
159
160 if(iconinfo.hbmMask)
161 {
162 GetObjectW(iconinfo.hbmMask, sizeof(BITMAP), &bmp);
163 SelectObject(hMemDC, iconinfo.hbmMask);
164 BitBlt(hDC, 200, 330, bmp.bmWidth, bmp.bmHeight, hMemDC, 0, 0, SRCCOPY);
165 DeleteObject(iconinfo.hbmMask);
166 TextOut(hDC, 160, 365 - 32 + bmp.bmHeight, cursormask, strlen(cursormask));
167
168 sprintf(str, "%dBPP", bmp.bmBitsPixel);
169 TextOut(hDC, 160, 380 - 32 + bmp.bmHeight, str, strlen(str));
170 }
171
172 if(iconinfo.hbmColor)
173 {
174 GetObjectW(iconinfo.hbmColor, sizeof(BITMAP), &bmp);
175 SelectObject(hMemDC, iconinfo.hbmColor);
176 BitBlt(hDC, 350, 330, bmp.bmWidth, bmp.bmHeight, hMemDC, 0, 0, SRCCOPY);
177 DeleteObject(iconinfo.hbmColor);
178 TextOut(hDC, 300, 365 - 32 + bmp.bmHeight, cursorcolor, strlen(cursorcolor));
179
180 sprintf(str, "%dBPP", bmp.bmBitsPixel);
181 TextOut(hDC, 300, 380 - 32 + bmp.bmHeight, str, strlen(str));
182 }
183 }
184 }
185
186 SelectObject(hMemDC, hOld);
187
188 DeleteObject(hMemDC);
189 EndPaint(hWnd, &ps);
190 break;
191
192 case WM_TIMER:
193 rc.left = 0;
194 rc.top = 330;
195 rc.right = 480;
196 rc.bottom = 480;
197 InvalidateRect(hWnd, &rc, TRUE);
198 break;
199
200 case WM_DESTROY:
202 break;
203
204 default:
206 }
207 return 0;
208}
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
#define IDI_ICON
Definition: resource.h:5
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
pKey DeleteObject()
GLuint res
Definition: glext.h:9613
HINSTANCE hInst
Definition: icontest.c:18
const char cursormask[]
Definition: icontest.c:14
const char titleMask[]
Definition: icontest.c:9
HFONT tf
Definition: icontest.c:17
const char titleXor[]
Definition: icontest.c:10
const char cursorcolor[]
Definition: icontest.c:15
const char titleDrwIco[]
Definition: icontest.c:8
const char cursor[]
Definition: icontest.c:13
#define sprintf(buf, format,...)
Definition: sprintf.c:55
BITMAP bmp
Definition: alphablend.c:62
static HDC
Definition: imagelist.c:92
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
#define DefWindowProc
Definition: ros2win.h:31
const WCHAR * str
Definition: bl.h:1331
DWORD yHotspot
Definition: winuser.h:3125
DWORD xHotspot
Definition: winuser.h:3124
HBITMAP hbmColor
Definition: winuser.h:3127
HBITMAP hbmMask
Definition: winuser.h:3126
Definition: fci.c:127
DWORD flags
Definition: winuser.h:3720
DWORD cbSize
Definition: winuser.h:3719
HCURSOR hCursor
Definition: winuser.h:3721
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define TRANSPARENT
Definition: wingdi.h:950
#define SRCCOPY
Definition: wingdi.h:333
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#define TextOut
Definition: wingdi.h:4483
#define WM_PAINT
Definition: winuser.h:1620
BOOL WINAPI GetCursorInfo(_Inout_ PCURSORINFO)
struct tagCURSORINFO CURSORINFO
#define LR_LOADFROMFILE
Definition: winuser.h:1092
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2045
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
BOOL WINAPI DrawIcon(_In_ HDC, _In_ int, _In_ int, _In_ HICON)
Definition: cursoricon.c:2018
#define WM_TIMER
Definition: winuser.h:1742
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define LoadImage
Definition: winuser.h:5815
#define WM_DESTROY
Definition: winuser.h:1609
#define LR_DEFAULTSIZE
Definition: winuser.h:1094
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2053
char CHAR
Definition: xmlstorage.h:175

Referenced by WinMain().

◆ WinMain()

int WINAPI WinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 23 of file icontest.c.

27{
28 WNDCLASS wc;
29 MSG msg;
30 HWND hWnd;
31
33
34 #ifdef _GetCursorInfo
35 GetCursorInfo = (GETCURSORINFO)GetProcAddress(GetModuleHandleW(L"user32.dll"), "GetCursorInfo");
36 #endif
37
38 wc.lpszClassName = "IconTestClass";
44 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
45 wc.lpszMenuName = NULL;
46 wc.cbClsExtra = 0;
47 wc.cbWndExtra = 0;
48 if (RegisterClass(&wc) == 0)
49 {
50 DbgPrint("RegisterClass failed (last error 0x%X)\n", GetLastError());
51 return(1);
52 }
53
54 hWnd = CreateWindow("IconTestClass",
55 "Icon Test",
59 480,
60 480,
61 NULL,
62 NULL,
64 NULL);
65 if (hWnd == NULL)
66 {
67 DbgPrint("CreateWindow failed (last error 0x%X)\n", GetLastError());
68 return(1);
69 }
70
74
75 ShowWindow(hWnd, nCmdShow);
76
77 SetTimer(hWnd, 1, 1000, NULL);
78
79 while(GetMessage(&msg, NULL, 0, 0))
80 {
83 }
84
85 return msg.wParam;
86}
HINSTANCE hInstance
Definition: charmap.c:19
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define DbgPrint
Definition: hal.h:12
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM)
Definition: icontest.c:88
#define L(x)
Definition: ntvdm.h:50
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
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
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FIXED_PITCH
Definition: wingdi.h:444
#define DEFAULT_QUALITY
Definition: wingdi.h:436
#define FF_DONTCARE
Definition: wingdi.h:448
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:415
#define ANSI_CHARSET
Definition: wingdi.h:383
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
#define FW_NORMAL
Definition: wingdi.h:373
#define TA_BASELINE
Definition: wingdi.h:928
HFONT WINAPI CreateFontA(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCSTR)
#define CS_VREDRAW
Definition: winuser.h:658
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _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 LoadIcon
Definition: winuser.h:5813
#define LoadCursor
Definition: winuser.h:5812
#define CW_USEDEFAULT
Definition: winuser.h:225
#define RegisterClass
Definition: winuser.h:5836
#define DispatchMessage
Definition: winuser.h:5765
#define COLOR_BTNFACE
Definition: winuser.h:928
const CHAR * LPCTSTR
Definition: xmlstorage.h:193

Variable Documentation

◆ cursor

const char cursor[] = "Current Cursor:"

Definition at line 13 of file icontest.c.

Referenced by _bdf_readstream(), abort_dochost_tasks(), ACTION_FinishCustomActions(), ACTION_InstallFiles(), ACTION_PatchFiles(), apartment_disconnectproxies(), apartment_findfromoxid(), apartment_findfromtid(), apartment_release(), BmpFrameDecode_ReadRLE4(), BmpFrameDecode_ReadRLE8(), cache_basic_authorization(), cache_get_cursor(), cache_put_cursor(), callback_child(), cctrl_event_OnButtonClicked(), cctrl_event_OnCheckButtonToggled(), cctrl_event_OnControlActivating(), cctrl_event_OnItemSelected(), CertAddStoreToCollection(), cfgets(), co_IntShellHookNotify(), CoInitializeEx(), COM_RevokeAllClasses(), COM_TlsDestroy(), Compartment_SetValue(), CompartmentEnumGuid_Next(), CompartmentMgr_ClearCompartment(), CompartmentMgr_Destructor(), CompartmentMgr_GetCompartment(), ComponentEnum_Release(), ContextPropertyList_EnumPropIDs(), CorDebug_Terminate(), CoUninitialize(), CreateCursor(), CryptInitOIDFunctionSet(), d3dx_effect_cleanup(), destroy_format(), DragList_SubclassWindowProc(), EDIT_ImeComposition(), empty_redo_stack(), events_OnFileOk(), events_OnFolderChange(), events_OnFolderChanging(), events_OnOverwrite(), events_OnSelectionChange(), events_OnTypeChange(), find_proxy_manager(), fnTextSrv_TxSetText(), free_assembly(), free_extension(), free_feature(), free_folder(), free_package_structures(), free_parsed_config_file(), FT_Stream_ReadFields(), get_cookie(), get_stub_manager(), get_stub_manager_from_ipid(), get_stub_manager_from_object(), gl_fixup(), handle_enter(), IAssemblyEnumImpl_Release(), IMAPIPROP_GetValue(), InputProcessorProfiles_ChangeCurrentLanguage(), IPropData_fnGetPropList(), IPropData_fnHrGetPropAccess(), IRichEditOle_fnGetObject(), itemize_para(), ITextRange_fnGetChar(), ITextRange_fnScrollIntoView(), ITextRange_fnSetText(), KeystrokeMgr_IsPreservedKey(), KeystrokeMgr_PreserveKey(), KeystrokeMgr_UnpreserveKey(), lz_analyze_block(), lzx_write_compressed_literals(), macho_unmap_file(), MainWndProc(), ME_Char(), ME_CharFromPos(), ME_EmptyUndoStack(), ME_FindNextURLCandidate(), ME_FindRunInRow(), ME_FindText(), ME_GetCursorOfs(), ME_GetSelectionType(), ME_GetTextLength(), ME_HandleMessage(), ME_InsertEndParaFromCursor(), ME_InsertRunAtCursor(), ME_InternalDeleteText(), ME_LinkNotify(), ME_MoveCursorChars(), ME_MoveCursorWords(), ME_RTFParAttrHook(), ME_SetCursor(), ME_SetCursorToEnd(), ME_SetCursorToStart(), ME_SplitRunSimple(), ME_StreamOutRTF(), ME_StreamOutText(), merge_free_rows(), mi_destroy_cursor(), mi_set_cursor(), MimeBody_DeleteProp(), MsiDatabaseMergeW(), OutputQueue_FreeSamples(), OutputQueueImpl_ThreadProc(), poll_queries(), process_colour_pointer_common(), process_colour_pointer_pdu(), PropertyStore_Release(), proxy_manager_destroy(), proxy_manager_disconnect(), proxy_manager_find_ifproxy(), PS_Conv_ASCIIHexDecode(), PS_Conv_EexecDecode(), PS_Conv_Strtol(), PS_Conv_ToFixed(), PS_Conv_ToInt(), ps_parser_skip_PS_token(), ps_table_add(), psh_hint_table_activate_mask(), psh_hint_table_record_mask(), radiobuttonlist_set_selected_item(), range_GetChar(), ReadByte(), RPC_UnregisterAllChannelHooks(), RunningObjectTableImpl_Destroy(), RunningObjectTableImpl_Release(), RuntimeHost_Destroy(), split_run_extents(), StdMemAllocator_Free(), stub_manager_delete(), stub_manager_ipid_to_ifstub(), test_child_process(), test_DestroyCursor(), test_enter(), test_enumerate(), test_initial_cursor(), test_SetCursor(), TextStoreACPSink_OnLockGranted(), ThreadFocusHookProc(), ThreadMgr_AssociateFocus(), ThreadMgr_Destructor(), ThreadMgr_OnDocumentMgrDestruction(), ThreadMgrEventSink_OnInitDocumentMgr(), ThreadMgrEventSink_OnPopContext(), ThreadMgrEventSink_OnPushContext(), ThreadMgrEventSink_OnSetFocus(), ThreadMgrEventSink_OnUninitDocumentMgr(), TransactedSnapshotImpl_CopyTree(), TransactedSnapshotImpl_DestroyTemporaryCopy(), TransactedSnapshotImpl_FindFirstChild(), ui_create_cursor(), ui_destroy_cursor(), ui_set_cursor(), UserBuildShellHookHwndList(), wined3d_device_delete_opengl_contexts_cs(), wined3d_device_evict_managed_resources(), wined3d_device_reset(), wined3d_device_set_cursor_properties(), and write_expr_eval_routine_list().

◆ cursorcolor

const char cursorcolor[] = "Cursor Color Bitmap"

Definition at line 15 of file icontest.c.

Referenced by MainWndProc().

◆ cursormask

const char cursormask[] = "Cursor Mask Bitmap"

Definition at line 14 of file icontest.c.

Referenced by MainWndProc().

◆ file

const char file[] = "Icon from file:"

Definition at line 11 of file icontest.c.

◆ hInst

HINSTANCE hInst

Definition at line 18 of file icontest.c.

Referenced by MainWndProc(), and WinMain().

◆ res

const char res[] = "Icon from Resource:"

Definition at line 12 of file icontest.c.

◆ tf

◆ titleDrwIco

const char titleDrwIco[] = "DrawIcon Output"

Definition at line 8 of file icontest.c.

Referenced by MainWndProc().

◆ titleMask

const char titleMask[] = "Mask(AND image)"

Definition at line 9 of file icontest.c.

Referenced by MainWndProc().

◆ titleXor

const char titleXor[] = "XOR(color image)"

Definition at line 10 of file icontest.c.

Referenced by MainWndProc().