ReactOS  0.4.11-dev-946-g431643b
charmap.c File Reference
#include "precomp.h"
#include <commctrl.h>
#include <richedit.h>
#include <winnls.h>
Include dependency graph for charmap.c:

Go to the source code of this file.

Macros

#define REMOVE_ADVANCED
 
#define ID_ABOUT   0x1
 

Functions

static int CALLBACK EnumFontNames (ENUMLOGFONTEXW *lpelfe, NEWTEXTMETRICEXW *lpntme, DWORD FontType, LPARAM lParam)
 
static VOID FillFontStyleComboList (HWND hwndCombo)
 
VOID ChangeMapFont (HWND hDlg)
 
static void CopyCharacters (HWND hDlg)
 
static BYTE GetFontMetrics (HWND hWnd, HFONT hFont)
 
static VOID AddCharToSelection (HWND hDlg, WCHAR ch)
 
VOID UpdateStatusBar (WCHAR wch)
 
static void ChangeView (HWND hWnd)
 
static INT_PTR CALLBACK CharMapDlgProc (HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
 
static int PanelOnCreate (HWND hWnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK PanelWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static HWND InitInstance (HINSTANCE hInst)
 
INT WINAPI wWinMain (HINSTANCE hInst, HINSTANCE hPrev, LPWSTR Cmd, int iCmd)
 

Variables

HINSTANCE hInstance
 
HWND hAdvancedDlg
 
HWND hCharmapDlg
 
HWND hStatusWnd
 
HICON hSmIcon
 
HICON hBgIcon
 
SETTINGS Settings
 

Macro Definition Documentation

◆ ID_ABOUT

◆ REMOVE_ADVANCED

#define REMOVE_ADVANCED

Definition at line 16 of file charmap.c.

Function Documentation

◆ AddCharToSelection()

static VOID AddCharToSelection ( HWND  hDlg,
WCHAR  ch 
)
static

Definition at line 202 of file charmap.c.

Referenced by CharMapDlgProc().

203 {
204  HWND hMap = GetDlgItem(hDlg, IDC_FONTMAP);
205  HWND hText = GetDlgItem(hDlg, IDC_TEXTBOX);
206  HFONT hFont;
207  LOGFONT lFont;
208  CHARFORMAT cf;
209 
210  // Retrieve current character selected
211  if (ch == 0)
212  {
213  ch = (WCHAR) SendMessageW(hMap, FM_GETCHAR, 0, 0);
214  if (!ch)
215  return;
216  }
217 
218  // Retrieve current selected font
219  hFont = (HFONT)SendMessage(hMap, FM_GETHFONT, 0, 0);
220 
221  // Recover LOGFONT structure from hFont
222  if (!GetObject(hFont, sizeof(LOGFONT), &lFont))
223  return;
224 
225  // Recover font properties of Richedit control
226  ZeroMemory(&cf, sizeof(cf));
227  cf.cbSize = sizeof(cf);
229 
230  // Apply properties of the new font
231  cf.bCharSet = GetFontMetrics(hText, hFont);
232 
233  // Update font name
234  wcscpy(cf.szFaceName, lFont.lfFaceName);
235 
236  // Update font properties
238 
239  // Send selected character to Richedit
240  SendMessage(hText, WM_CHAR, (WPARAM)ch, 0);
241 }
static IClassFactory * cf
#define WM_CHAR
Definition: winuser.h:1693
#define IDC_TEXTBOX
Definition: resource.h:15
#define ZeroMemory
Definition: winbase.h:1635
#define WCHAR
Definition: msvc.h:43
HFONT hFont
Definition: main.c:53
UINT_PTR WPARAM
Definition: windef.h:207
LONG_PTR LPARAM
Definition: windef.h:208
#define EM_SETCHARFORMAT
Definition: richedit.h:101
#define FM_GETHFONT
Definition: precomp.h:25
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define GetObject
Definition: wingdi.h:4445
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define FM_GETCHAR
Definition: precomp.h:23
#define EM_GETCHARFORMAT
Definition: richedit.h:91
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define SendMessage
Definition: winuser.h:5709
#define SCF_SELECTION
Definition: richedit.h:235
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
static BYTE GetFontMetrics(HWND hWnd, HFONT hFont)
Definition: charmap.c:184
#define IDC_FONTMAP
Definition: resource.h:14

◆ ChangeMapFont()

VOID ChangeMapFont ( HWND  hDlg)

Definition at line 113 of file charmap.c.

Referenced by CharMapDlgProc(), and LoadSettings().

114 {
115  HWND hCombo;
116  HWND hMap;
117  LPWSTR lpFontName;
118  INT Len;
119 
120  hCombo = GetDlgItem(hDlg, IDC_FONTCOMBO);
121 
122  Len = GetWindowTextLengthW(hCombo);
123 
124  if (Len != 0)
125  {
126  lpFontName = HeapAlloc(GetProcessHeap(),
127  0,
128  (Len + 1) * sizeof(WCHAR));
129 
130  if (lpFontName)
131  {
132  SendMessageW(hCombo,
133  WM_GETTEXT,
134  Len + 1,
135  (LPARAM)lpFontName);
136 
137  hMap = GetDlgItem(hDlg, IDC_FONTMAP);
138 
139  SendMessageW(hMap,
140  FM_SETFONT,
141  0,
142  (LPARAM)lpFontName);
143  }
144 
146  0,
147  lpFontName);
148  }
149 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_GETTEXT
Definition: winuser.h:1600
int32_t INT
Definition: typedefs.h:56
LONG_PTR LPARAM
Definition: windef.h:208
#define FM_SETFONT
Definition: precomp.h:22
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define Len
Definition: deflate.h:82
#define IDC_FONTCOMBO
Definition: resource.h:12
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
#define IDC_FONTMAP
Definition: resource.h:14

◆ ChangeView()

static void ChangeView ( HWND  hWnd)
static

Definition at line 274 of file charmap.c.

Referenced by CharMapDlgProc(), and PanelOnCreate().

275 {
276  RECT rcCharmap;
277 #ifndef REMOVE_ADVANCED
278  RECT rcAdvanced;
279 #endif
280  RECT rcPanelExt;
281  RECT rcPanelInt;
282  RECT rcStatus;
283  UINT DeX, DeY;
284  UINT xPos, yPos;
285  UINT Width, Height;
286  UINT DeskTopWidth, DeskTopHeight;
287 
288  GetClientRect(hCharmapDlg, &rcCharmap);
289 #ifndef REMOVE_ADVANCED
290  GetClientRect(hAdvancedDlg, &rcAdvanced);
291 #endif
292  GetWindowRect(hWnd, &rcPanelExt);
293  GetClientRect(hWnd, &rcPanelInt);
294  GetClientRect(hStatusWnd, &rcStatus);
295 
296  DeskTopWidth = GetSystemMetrics(SM_CXFULLSCREEN);
297  DeskTopHeight = GetSystemMetrics(SM_CYFULLSCREEN);
298 
299  DeX = (rcPanelExt.right - rcPanelExt.left) - rcPanelInt.right;
300  DeY = (rcPanelExt.bottom - rcPanelExt.top) - rcPanelInt.bottom;
301 
302  MoveWindow(hCharmapDlg, 0, 0, rcCharmap.right, rcCharmap.bottom, FALSE);
303 #ifndef REMOVE_ADVANCED
304  MoveWindow(hAdvancedDlg, 0, rcCharmap.bottom, rcAdvanced.right, rcAdvanced.bottom, FALSE);
306 #endif
307  xPos = rcPanelExt.left;
308  yPos = rcPanelExt.top;
309 
310  Width = DeX + rcCharmap.right;
311  Height = DeY + rcCharmap.bottom + rcStatus.bottom;
312 #ifndef REMOVE_ADVANCED
314  Height += rcAdvanced.bottom;
315 #endif
316  if ((xPos + Width) > DeskTopWidth)
317  xPos += DeskTopWidth - (xPos + Width);
318 
319  if ((yPos + Height) > DeskTopHeight)
320  yPos += DeskTopHeight - (yPos + Height);
321 
322  MoveWindow(hWnd,
323  xPos, yPos,
324  Width, Height,
325  TRUE);
326 }
HWND hStatusWnd
Definition: charmap.c:23
BOOL IsAdvancedView
Definition: precomp.h:63
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LONG right
Definition: windef.h:298
#define SW_SHOW
Definition: winuser.h:769
unsigned int UINT
Definition: ndis.h:50
int WINAPI GetSystemMetrics(_In_ int)
SETTINGS Settings
Definition: charmap.c:26
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND hCharmapDlg
Definition: charmap.c:22
#define SM_CYFULLSCREEN
Definition: winuser.h:968
LONG bottom
Definition: windef.h:299
#define SM_CXFULLSCREEN
Definition: winuser.h:967
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
HWND hAdvancedDlg
Definition: charmap.c:21

◆ CharMapDlgProc()

static INT_PTR CALLBACK CharMapDlgProc ( HWND  hDlg,
UINT  Message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 331 of file charmap.c.

Referenced by PanelOnCreate().

335 {
336  switch(Message)
337  {
338  case WM_INITDIALOG:
339  {
340  DWORD evMask;
341 #ifdef REMOVE_ADVANCED
342  HWND hAdv;
343 #endif
344 
346  IDC_FONTCOMBO));
347 
348  ChangeMapFont(hDlg);
349 
350  // Configure Richedit control for sending notification changes.
351  evMask = SendDlgItemMessage(hDlg, IDC_TEXTBOX, EM_GETEVENTMASK, 0, 0);
352  evMask |= ENM_CHANGE;
354 #ifdef REMOVE_ADVANCED
355  hAdv = GetDlgItem(hDlg, IDC_CHECK_ADVANCED);
356  ShowWindow(hAdv, SW_HIDE);
357 #endif
358  return TRUE;
359  }
360 
361  case WM_COMMAND:
362  {
363  switch(LOWORD(wParam))
364  {
365  case IDC_FONTMAP:
366  switch (HIWORD(wParam))
367  {
368  case FM_SETCHAR:
370  break;
371  }
372  break;
373 
374  case IDC_FONTCOMBO:
375  if (HIWORD(wParam) == CBN_SELCHANGE)
376  {
377  ChangeMapFont(hDlg);
378  }
379  break;
380 
381  case IDC_SELECT:
382  AddCharToSelection(hDlg, 0);
383  break;
384 
385  case IDC_TEXTBOX:
386  switch (HIWORD(wParam)) {
387  case EN_CHANGE:
388  if (GetWindowTextLength(GetDlgItem(hDlg, IDC_TEXTBOX)) == 0)
390  else
392  break;
393  }
394  break;
395 
396  case IDC_COPY:
397  CopyCharacters(hDlg);
398  break;
399 #ifndef REMOVE_ADVANCED
400  case IDC_CHECK_ADVANCED:
401  UpdateSettings(hDlg);
402  ChangeView(GetParent(hDlg));
403  break;
404 #endif
405  }
406  }
407  break;
408 
409  default:
410  break;
411  }
412 
413  return FALSE;
414 }
#define TRUE
Definition: types.h:120
#define EM_GETEVENTMASK
Definition: richedit.h:92
#define IDC_CHECK_ADVANCED
Definition: resource.h:26
#define IDC_TEXTBOX
Definition: resource.h:15
#define SW_HIDE
Definition: winuser.h:762
static void ChangeView(HWND hWnd)
Definition: charmap.c:274
#define SendDlgItemMessage
Definition: winuser.h:5708
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
WPARAM wParam
Definition: combotst.c:138
static VOID FillFontStyleComboList(HWND hwndCombo)
Definition: charmap.c:77
HWND hAdv
Definition: advanced.c:14
LONG_PTR LPARAM
Definition: windef.h:208
static void CopyCharacters(HWND hDlg)
Definition: charmap.c:154
#define EM_SETEVENTMASK
Definition: richedit.h:102
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_COPY
Definition: resource.h:17
unsigned long DWORD
Definition: ntddk_ex.h:95
CHAR Message[80]
Definition: alive.c:5
#define ENM_CHANGE
Definition: richedit.h:468
#define WM_COMMAND
Definition: winuser.h:1716
#define IDC_FONTCOMBO
Definition: resource.h:12
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
VOID ChangeMapFont(HWND hDlg)
Definition: charmap.c:113
#define FM_SETCHAR
Definition: precomp.h:24
HWND WINAPI GetParent(_In_ HWND)
#define CBN_SELCHANGE
Definition: winuser.h:1940
#define IDC_SELECT
Definition: resource.h:16
#define HIWORD(l)
Definition: typedefs.h:246
#define GetWindowTextLength
Definition: winuser.h:5665
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
static VOID AddCharToSelection(HWND hDlg, WCHAR ch)
Definition: charmap.c:202
#define IDC_FONTMAP
Definition: resource.h:14
#define EN_CHANGE
Definition: winuser.h:1983

◆ CopyCharacters()

static void CopyCharacters ( HWND  hDlg)
static

Definition at line 154 of file charmap.c.

Referenced by CharMapDlgProc().

155 {
156  HWND hText = GetDlgItem(hDlg, IDC_TEXTBOX);
157  DWORD dwStart, dwEnd;
158 
159  // Acquire selection limits
160  SendMessage(hText, EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd);
161 
162  // Test if the whose text is unselected
163  if(dwStart == dwEnd) {
164 
165  // Select the whole text
166  SendMessageW(hText, EM_SETSEL, 0, -1);
167 
168  // Copy text
169  SendMessageW(hText, WM_COPY, 0, 0);
170 
171  // Restore previous values
172  SendMessageW(hText, EM_SETSEL, (WPARAM)dwStart, (LPARAM)dwEnd);
173 
174  } else {
175 
176  // Copy text
177  SendMessageW(hText, WM_COPY, 0, 0);
178  }
179 }
#define IDC_TEXTBOX
Definition: resource.h:15
UINT_PTR WPARAM
Definition: windef.h:207
#define EM_GETSEL
Definition: winuser.h:1958
#define WM_COPY
Definition: winuser.h:1823
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define EM_SETSEL
Definition: winuser.h:1979
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SendMessage
Definition: winuser.h:5709

◆ EnumFontNames()

static int CALLBACK EnumFontNames ( ENUMLOGFONTEXW lpelfe,
NEWTEXTMETRICEXW lpntme,
DWORD  FontType,
LPARAM  lParam 
)
static

Definition at line 32 of file charmap.c.

Referenced by FillFontStyleComboList().

36 {
37  HWND hwndCombo = (HWND)lParam;
38  LPWSTR pszName = lpelfe->elfLogFont.lfFaceName;
39 
40  /* Skip rotated font */
41  if(pszName[0] == L'@') return 1;
42 
43  /* make sure font doesn't already exist in our list */
44  if(SendMessageW(hwndCombo,
46  0,
47  (LPARAM)pszName) == CB_ERR)
48  {
49  INT idx;
50  BOOL fFixed;
51  BOOL fTrueType;
52 
53  /* add the font */
54  idx = (INT)SendMessageW(hwndCombo,
56  0,
57  (LPARAM)pszName);
58 
59  /* record the font's attributes (Fixedwidth and Truetype) */
60  fFixed = (lpelfe->elfLogFont.lfPitchAndFamily & FIXED_PITCH) ? TRUE : FALSE;
61  fTrueType = (lpelfe->elfLogFont.lfOutPrecision == OUT_STROKE_PRECIS) ? TRUE : FALSE;
62 
63  /* store this information in the list-item's userdata area */
64  SendMessageW(hwndCombo,
66  idx,
67  MAKEWPARAM(fFixed, fTrueType));
68  }
69 
70  return 1;
71 }
#define CB_SETITEMDATA
Definition: winuser.h:1927
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3916
BYTE lfPitchAndFamily
Definition: dimm.idl:71
HANDLE HWND
Definition: compat.h:13
int32_t INT
Definition: typedefs.h:56
LONG_PTR LPARAM
Definition: windef.h:208
#define FIXED_PITCH
Definition: wingdi.h:442
#define INT(a)
Definition: assyntax.h:463
unsigned int idx
Definition: utils.c:41
#define CB_ADDSTRING
Definition: winuser.h:1897
#define CB_ERR
Definition: winuser.h:2389
BYTE lfOutPrecision
Definition: dimm.idl:68
unsigned int BOOL
Definition: ntddk_ex.h:94
#define OUT_STROKE_PRECIS
Definition: wingdi.h:416
static const WCHAR L[]
Definition: oid.c:1087
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LOGFONTW elfLogFont
Definition: wingdi.h:2679
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPARAM lParam
Definition: combotst.c:139
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1901

◆ FillFontStyleComboList()

static VOID FillFontStyleComboList ( HWND  hwndCombo)
static

Definition at line 77 of file charmap.c.

Referenced by CharMapDlgProc(), and MainWndCreateToolbarClient().

78 {
79  HDC hdc;
80  LOGFONTW lf;
81 
82  /* FIXME: for fun, draw each font in its own style */
84  SendMessageW(hwndCombo,
85  WM_SETFONT,
86  (WPARAM)hFont,
87  0);
88 
89  ZeroMemory(&lf, sizeof(lf));
91 
92  hdc = GetDC(hwndCombo);
93 
94  /* store the list of fonts in the combo */
96  &lf,
98  (LPARAM)hwndCombo,
99  0);
100 
101  ReleaseDC(hwndCombo,
102  hdc);
103 
104  SendMessageW(hwndCombo,
105  CB_SETCURSEL,
106  0,
107  0);
108 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define HDC
Definition: msvc.h:22
HDC WINAPI GetDC(_In_opt_ HWND)
int WINAPI EnumFontFamiliesExW(_In_ HDC, _In_ PLOGFONTW, _In_ FONTENUMPROCW, _In_ LPARAM, _In_ DWORD)
BYTE lfCharSet
Definition: dimm.idl:67
#define ZeroMemory
Definition: winbase.h:1635
#define DEFAULT_CHARSET
Definition: wingdi.h:382
HFONT hFont
Definition: main.c:53
UINT_PTR WPARAM
Definition: windef.h:207
LONG_PTR LPARAM
Definition: windef.h:208
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC hdc
Definition: msvc.h:53
static int CALLBACK EnumFontNames(ENUMLOGFONTEXW *lpelfe, NEWTEXTMETRICEXW *lpntme, DWORD FontType, LPARAM lParam)
Definition: charmap.c:32
#define DEFAULT_GUI_FONT
Definition: wingdi.h:907
#define CB_SETCURSEL
Definition: winuser.h:1922
FARPROC FONTENUMPROCW
Definition: wingdi.h:2874
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETFONT
Definition: winuser.h:1632
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)

◆ GetFontMetrics()

static BYTE GetFontMetrics ( HWND  hWnd,
HFONT  hFont 
)
static

Definition at line 184 of file charmap.c.

Referenced by AddCharToSelection().

185 {
186  TEXTMETRIC tmFont;
187  HGDIOBJ hOldObj;
188  HDC hDC;
189 
190  hDC = GetDC(hWnd);
191  hOldObj = SelectObject(hDC, hFont);
192  GetTextMetrics(hDC, &tmFont);
193  SelectObject(hDC, hOldObj);
194  ReleaseDC(hWnd, hDC);
195 
196  return tmFont.tmCharSet;
197 }
#define HDC
Definition: msvc.h:22
HDC WINAPI GetDC(_In_opt_ HWND)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define GetTextMetrics
Definition: wingdi.h:4451
HFONT hFont
Definition: main.c:53
BYTE tmCharSet
Definition: wingdi.h:2357
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
static HDC hDC
Definition: 3dtext.c:33

◆ InitInstance()

static HWND InitInstance ( HINSTANCE  hInst)
static

Definition at line 517 of file charmap.c.

Referenced by ScreenSaverProc(), and wWinMain().

518 {
519  WCHAR szClass[] = L"CharMap";
520  WCHAR szTitle[256];
521  WNDCLASSEXW wc;
522  HWND hWnd;
523 
524  LoadStringW(hInst, IDS_TITLE, szTitle, SIZEOF(szTitle));
525 
528  IMAGE_ICON,
529  16,
530  16,
531  0);
532 
535  IMAGE_ICON,
536  32,
537  32,
538  0);
539 
540  // Create workspace
541  ZeroMemory(&wc, sizeof(wc));
542 
543  wc.cbSize = sizeof(wc);
545  wc.hInstance = hInst;
546  wc.hIcon = hBgIcon;
549  wc.lpszMenuName = NULL;
550  wc.lpszClassName = szClass;
551  wc.hIconSm = hSmIcon;
552 
553  RegisterClassExW(&wc);
554 
555  hWnd = CreateWindowW(
556  szClass,
557  szTitle,
563  NULL,
564  NULL,
565  hInst,
566  NULL);
567 
568  if (hWnd != NULL)
569  {
570  LoadSettings();
571  ShowWindow(hWnd, SW_SHOW);
572  UpdateWindow(hWnd);
573  }
574 
575  return hWnd;
576 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define IDI_ICON
Definition: resource.h:5
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IMAGE_ICON
Definition: winuser.h:212
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NULL_BRUSH
Definition: wingdi.h:899
HICON hSmIcon
Definition: charmap.c:24
BOOL WINAPI UpdateWindow(_In_ HWND)
HWND hWnd
Definition: settings.c:17
#define ZeroMemory
Definition: winbase.h:1635
HICON hIcon
Definition: winuser.h:3175
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4185
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
HINSTANCE hInstance
Definition: charmap.c:20
LPCWSTR lpszMenuName
Definition: winuser.h:3178
#define SIZEOF(_ar)
Definition: calc.h:48
void LoadSettings(void)
Definition: settings.c:53
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
LPCWSTR lpszClassName
Definition: winuser.h:3179
#define WS_CAPTION
Definition: pedump.c:624
static LRESULT CALLBACK PanelWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: charmap.c:482
#define IDS_TITLE
Definition: resource.h:30
HBRUSH hbrBackground
Definition: winuser.h:3177
UINT cbSize
Definition: winuser.h:3169
HICON hBgIcon
Definition: charmap.c:25
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:36
HINSTANCE hInstance
Definition: winuser.h:3174
static const WCHAR L[]
Definition: oid.c:1087
HCURSOR hCursor
Definition: winuser.h:3176
#define LoadCursor
Definition: winuser.h:5678
WNDPROC lpfnWndProc
Definition: winuser.h:3171
HINSTANCE hInst
Definition: dxdiag.c:13
#define WS_MINIMIZEBOX
Definition: pedump.c:631
HICON hIconSm
Definition: winuser.h:3180
#define IDC_ARROW
Definition: winuser.h:682
#define LoadImage
Definition: winuser.h:5681
#define WS_SYSMENU
Definition: pedump.c:629

◆ PanelOnCreate()

static int PanelOnCreate ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 438 of file charmap.c.

Referenced by PanelWndProc().

439 {
440  HMENU hSysMenu;
441  WCHAR lpAboutText[256];
442 
445  hWnd,
447 #ifndef REMOVE_ADVANCED
450  hWnd,
452 #endif
454  NULL,
456  0, 0, 0, 0,
457  hWnd,
459  hInstance,
460  NULL);
461 
462  // Set the status bar for multiple parts output
464 
465  ChangeView(hWnd);
466 
467  hSysMenu = GetSystemMenu(hWnd, FALSE);
468 
469  if (hSysMenu != NULL)
470  {
471  if (LoadStringW(hInstance, IDS_ABOUT, lpAboutText, SIZEOF(lpAboutText)))
472  {
473  AppendMenuW(hSysMenu, MF_SEPARATOR, 0, NULL);
474  AppendMenuW(hSysMenu, MF_STRING, ID_ABOUT, lpAboutText);
475  }
476  }
477 
478  return 0;
479 }
HWND hStatusWnd
Definition: charmap.c:23
#define MAKEINTRESOURCE
Definition: winuser.h:591
static INT_PTR CALLBACK CharMapDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: charmap.c:331
#define CreateWindow
Definition: winuser.h:5620
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MF_STRING
Definition: winuser.h:138
static void ChangeView(HWND hWnd)
Definition: charmap.c:274
#define WS_CHILD
Definition: pedump.c:617
#define STATUSCLASSNAME
Definition: commctrl.h:1909
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI AppendMenuW(_In_ HMENU, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define IDS_ABOUT
Definition: resource.h:29
HINSTANCE hInstance
Definition: charmap.c:20
#define SIZEOF(_ar)
Definition: calc.h:48
#define IDD_STATUSBAR
Definition: resource.h:9
LONG_PTR LPARAM
Definition: windef.h:208
#define SB_SIMPLE
Definition: commctrl.h:1928
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
smooth NULL
Definition: ftsmooth.c:416
INT_PTR CALLBACK AdvancedDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: advanced.c:511
#define MF_SEPARATOR
Definition: winuser.h:137
#define ID_ABOUT
Definition: charmap.c:18
#define IDD_CHARMAP
Definition: resource.h:7
HWND hCharmapDlg
Definition: charmap.c:22
#define SendMessage
Definition: winuser.h:5709
HWND hAdvancedDlg
Definition: charmap.c:21
#define WS_VISIBLE
Definition: pedump.c:620
#define IDD_ADVANCED
Definition: resource.h:10
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define CreateDialog
Definition: winuser.h:5615

◆ PanelWndProc()

static LRESULT CALLBACK PanelWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 482 of file charmap.c.

Referenced by InitInstance().

483 {
484  switch (msg) {
485  case WM_CREATE:
486  // For now, the Help push button is disabled because of lacking of HTML Help support
488  return PanelOnCreate(hWnd, wParam, lParam);
489 
490  case WM_CLOSE:
491  DestroyWindow(hWnd);
492  return 0;
493 
494  case WM_SIZE:
496  break;
497 
498  case WM_DESTROY:
499  SaveSettings();
500  PostQuitMessage(0);
501  return 0;
502 
503  case WM_SYSCOMMAND:
504  switch(wParam) {
505  case ID_ABOUT:
506  ShowAboutDlg(hWnd);
507  break;
508  }
509  break;
510 
511  }
512 
513  return DefWindowProc(hWnd, msg, wParam, lParam);
514 }
HWND hStatusWnd
Definition: charmap.c:23
VOID ShowAboutDlg(HWND hWndParent)
Definition: about.c:77
#define IDC_CMHELP
Definition: resource.h:13
BOOL WINAPI DestroyWindow(_In_ HWND)
WPARAM wParam
Definition: combotst.c:138
void SaveSettings(void)
Definition: settings.c:113
UINT msg
Definition: msvc.h:92
#define ID_ABOUT
Definition: charmap.c:18
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_SIZE
Definition: winuser.h:1593
#define WM_CLOSE
Definition: winuser.h:1603
static int PanelOnCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: charmap.c:438
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SendMessage
Definition: winuser.h:5709
#define WM_CREATE
Definition: winuser.h:1590
#define WM_SYSCOMMAND
Definition: winuser.h:1717
LPARAM lParam
Definition: combotst.c:139
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

◆ UpdateStatusBar()

VOID UpdateStatusBar ( WCHAR  wch)

Definition at line 262 of file charmap.c.

Referenced by DeckClickProc(), LrgCellWndProc(), NewGame(), RowStackClickProc(), RowStackDropProc(), SuitStackAddProc(), and SuitStackDropProc().

263 {
265  WCHAR szDesc[MAX_PATH];
266 
267  GetUName(wch, szDesc);
268  wsprintfW(buff, L"U+%04X: %s", wch, szDesc);
270 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
HWND hStatusWnd
Definition: charmap.c:23
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG_PTR LPARAM
Definition: windef.h:208
#define MAX_PATH
Definition: compat.h:26
static const WCHAR L[]
Definition: oid.c:1087
#define SB_SETTEXT
Definition: commctrl.h:1919
int WINAPI GetUName(IN WORD wCharCode, OUT LPWSTR lpBuf)
Definition: getuname.c:17
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static unsigned char buff[32768]
Definition: fatten.c:17

◆ wWinMain()

INT WINAPI wWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPWSTR  lpCmdLine,
int  nShowCmd 
)

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 580 of file charmap.c.

584 {
586  INT Ret = 1;
587  HMODULE hRichEd20;
588  MSG Msg;
589 
590  hInstance = hInst;
591 
592  /* Mirroring code for the titlebar */
593  switch (GetUserDefaultUILanguage())
594  {
597  break;
598 
599  default:
600  break;
601  }
602 
603  iccx.dwSize = sizeof(INITCOMMONCONTROLSEX);
604  iccx.dwICC = ICC_TAB_CLASSES;
605  InitCommonControlsEx(&iccx);
606 
608  {
609  hRichEd20 = LoadLibraryW(L"RICHED20.DLL");
610 
611  if (hRichEd20 != NULL)
612  {
613  InitInstance(hInst);
614 
615  for (;;)
616  {
617  if (GetMessage(&Msg, NULL, 0, 0) <= 0)
618  {
619  Ret = Msg.wParam;
620  break;
621  }
622 
623  TranslateMessage(&Msg);
624  DispatchMessage(&Msg);
625  }
626 
627  FreeLibrary(hRichEd20);
628  }
630  }
631 
632  return Ret;
633 }
#define DispatchMessage
Definition: winuser.h:5631
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: lang.c:561
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define LAYOUT_RTL
Definition: wingdi.h:1352
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define SUBLANG_DEFAULT
Definition: nls.h:168
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
int32_t INT
Definition: typedefs.h:56
#define LANG_HEBREW
Definition: nls.h:67
static HWND InitInstance(HINSTANCE hInst)
Definition: charmap.c:517
struct @1571 Msg[]
HINSTANCE hInstance
Definition: charmap.c:20
VOID UnregisterMapClasses(HINSTANCE hInstance)
Definition: map.c:672
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1686
#define FreeLibrary(x)
Definition: compat.h:405
static const WCHAR L[]
Definition: oid.c:1087
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
BOOL RegisterMapClasses(HINSTANCE hInstance)
Definition: map.c:646
HINSTANCE hInst
Definition: dxdiag.c:13
#define GetMessage
Definition: winuser.h:5656
#define MAKELANGID(p, s)
Definition: nls.h:15
#define ICC_TAB_CLASSES
Definition: commctrl.h:61

Variable Documentation

◆ hAdvancedDlg

HWND hAdvancedDlg

Definition at line 21 of file charmap.c.

◆ hBgIcon

HICON hBgIcon

Definition at line 25 of file charmap.c.

Referenced by InitInstance().

◆ hCharmapDlg

HWND hCharmapDlg

Definition at line 22 of file charmap.c.

Referenced by LoadSettings(), and SaveSettings().

◆ hInstance

HINSTANCE hInstance

Definition at line 20 of file charmap.c.

Referenced by _RegisterClass(), _RegisterClassA(), _tWinMain(), AboutDialogProc(), AddTextButton(), AllocAndLoadString(), AssertFail(), ATL::AtlGetStringResourceImage(), ChangeListViewText(), ClassTest(), ATL::CAtlModule::CommonInitRegistrar(), Confirm(), ConResMsgPrintfEx(), ConResMsgPrintfExV(), ConResPagingEx(), ConResPrintfEx(), ConResPrintfExV(), ConResPutsEx(), CreateDialogProc(), CreateEditWindow(), CreateFontBoxesWindow(), CreateFontWindow(), CreateHelpDialogProc(), CreateImageEditWindow(), CreateLargeCell(), CreateListView(), CreatePerfWindows(), CreatePropSheet(), CreateStandardProfile(), CreateStarBitmap(), CreateStopDependsDialog(), CreateTestWindow(), CreateWindowExA(), CreateWindowExW(), CRYPT_FormatAltNameEntry(), CRYPT_FormatAuthorityInfoAccess(), CRYPT_FormatBasicConstraints2(), CRYPT_FormatCertIssuer(), CRYPT_FormatCRLDistPoints(), CRYPT_FormatEnhancedKeyUsage(), CRYPT_FormatHexStringWithPrefix(), CRYPT_FormatKeyUsage(), CRYPT_FormatNetscapeCertType(), CRYPT_FormatReason(), CRYPT_FormatSpcFinancialCriteria(), D3DTests(), DDTests(), DECLARE_INTERFACE_(), DeleteDialogProc(), device_tests(), Display_InitClass(), DlgMainProc(), DllMain(), DllRegisterServer(), DoCreate(), DoDeleteService(), EditCurrentGlyph(), EnumJoysticks(), error(), EventLogProperties(), FloatToolbarCreateColorsGui(), FloatToolbarCreateHistoryGui(), FloatToolbarCreateToolsGui(), get_print_file_filter(), GetUserDiskFreeSpace(), GPNotificationThreadProc(), if(), ImageEditWndProc(), ExplorerGlobals::init(), init_oid_info(), init_preview(), InitApplication(), InitDialog(), InitEditGlyphWndClasses(), InitEditWindowImpl(), InitEditWnd(), InitFloatWndClass(), InitFontBoxesWndClass(), InitFontWndClass(), Initialize(), InitializeAtlModule(), InitializeProfiles(), InitImageEditWindowImpl(), InitImageList(), InitInstance(), InitInstance_wave(), InitListViewImage(), InitLogo(), InitPropSheetPage(), InitRecoveryPage(), InitToolbox(), InitUserApiHook(), InternetTransport_RegisterClass(), IntGetClassAtom(), IsCallProcHandle(), joystick_tests(), K32LoadStringExW(), K32LoadStringW(), keyboard_tests(), LengthOfStrResource(), LoadAllocStringW(), ATL::CImage::LoadFromResource(), LocalesEnumProc(), LsapInitSids(), LsarpLookupPrivilegeDisplayName(), MainWndProc(), MessageBoxRes(), mouse_tests(), MyRegisterClass(), MyRegisterClass_wave(), NewDocSelDlgProc(), NtUserCreateWindowEx(), oid_init_localizednames(), OnCommandAbout(), OnInitDialog(), OpenRDPConnectDialog(), ParallelPortPropPageProvider(), PrintAllJobs(), PrintJobDetails(), promptdisk_init(), PropertySheetDialog::PropertySheetDialog(), PropSheetPage::PropSheetPage(), PropSheetThread(), RegisterBlankClass(), RegisterCheckListControl(), RegisterConWndClass(), RegisterHexEditorClass(), RegisterMapClasses(), RegisterMonitorSelectionControl(), RegisterMonthCalControl(), RegisterPreviewControl(), RegisterTestDialog(), RegisterWinPrevClass(), ResetProgressDialog(), RichEditOleCallback_GetContextMenu(), RtlLoadUnicodeString(), RunActionWithProgress(), RunLiveCD(), SampInitializeSAM(), ScreenSaverProc(), SerialPortPropPageProvider(), SetServiceStatusText(), SetStartupType(), SetupControls(), SetupDiGetClassImageListExW(), SetupDiLoadClassIcon(), SetUpMDIChildWindowClass(), SetupPromptForDiskW(), ShowAboutDlg(), START_TEST(), StartWithDesktop(), TbdCreateToolbarWnd(), TbdInitializeDocks(), TbdInitImpl(), TbdUninitImpl(), TdbInsertToolbar(), test_capture_4(), test_ime_processkey(), test_Input_unicode(), test_Input_whitebox(), test_menu_input(), test_pack_CREATESTRUCTA(), test_pack_CREATESTRUCTW(), test_pack_MSGBOXPARAMSA(), test_pack_MSGBOXPARAMSW(), test_pack_WNDCLASSA(), test_pack_WNDCLASSEXA(), test_pack_WNDCLASSEXW(), test_pack_WNDCLASSW(), TOOLBAR_LoadImages(), TreeListRegister(), TV1_AddDependantsToTree(), TV2_AddDependantsToTree(), UnInitEditGlyphWndClasses(), UninitEditWindowImpl(), UninitFloatWndImpl(), UnInitFontBoxesWndClass(), UnInitFontWndClass(), UninitImageEditWindowImpl(), UpdateUsersShellFolderSettings(), UserGetClassInfo(), warning(), WinMain(), and wWinMain().

◆ hSmIcon

HICON hSmIcon

Definition at line 24 of file charmap.c.

Referenced by InitInstance().

◆ hStatusWnd

HWND hStatusWnd

Definition at line 23 of file charmap.c.

Referenced by PerformancePageRefreshThread(), and set_statusbar_state().

◆ Settings