comctl32: Use wide-char string literals.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-11-16 17:26:34 +03:00 committed by Alexandre Julliard
parent 621ed4b61d
commit 564d5804b1
16 changed files with 38 additions and 70 deletions

View File

@ -400,9 +400,6 @@ static void CBGetDroppedControlRect( LPHEADCOMBO lphc, LPRECT lpRect)
*/
static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG style )
{
static const WCHAR clbName[] = {'C','o','m','b','o','L','B','o','x',0};
static const WCHAR editName[] = {'E','d','i','t',0};
OpenThemeData( hwnd, WC_COMBOBOXW );
if( !CB_GETTYPE(lphc) ) lphc->dwStyle |= CBS_SIMPLE;
if( CB_GETTYPE(lphc) != CBS_DROPDOWNLIST ) lphc->wState |= CBF_EDIT;
@ -488,7 +485,7 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
lbeExStyle |= (WS_EX_TOPMOST | WS_EX_TOOLWINDOW);
}
lphc->hWndLBox = CreateWindowExW(lbeExStyle, clbName, NULL, lbeStyle,
lphc->hWndLBox = CreateWindowExW(lbeExStyle, L"ComboLBox", NULL, lbeStyle,
lphc->droppedRect.left, lphc->droppedRect.top, lphc->droppedRect.right - lphc->droppedRect.left,
lphc->droppedRect.bottom - lphc->droppedRect.top, hwnd, (HMENU)ID_CB_LISTBOX,
(HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ), lphc );
@ -510,7 +507,7 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED;
lphc->hWndEdit = CreateWindowExW(0, editName, NULL, lbeStyle,
lphc->hWndEdit = CreateWindowExW(0, WC_EDITW, NULL, lbeStyle,
lphc->textRect.left, lphc->textRect.top,
lphc->textRect.right - lphc->textRect.left,
lphc->textRect.bottom - lphc->textRect.top,
@ -648,8 +645,7 @@ static void CBPaintText(HEADCOMBO *lphc, HDC hdc_paint)
if( lphc->wState & CBF_EDIT )
{
static const WCHAR empty_stringW[] = { 0 };
if( CB_HASSTRINGS(lphc) ) SetWindowTextW( lphc->hWndEdit, pText ? pText : empty_stringW );
if( CB_HASSTRINGS(lphc) ) SetWindowTextW( lphc->hWndEdit, pText ? pText : L"" );
if( lphc->wState & CBF_FOCUSED )
SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, MAXLONG);
}
@ -705,8 +701,6 @@ static void CBPaintText(HEADCOMBO *lphc, HDC hdc_paint)
}
else
{
static const WCHAR empty_stringW[] = { 0 };
if ( (lphc->wState & CBF_FOCUSED) &&
!(lphc->wState & CBF_DROPPED) ) {
@ -721,7 +715,7 @@ static void CBPaintText(HEADCOMBO *lphc, HDC hdc_paint)
rectEdit.top + 1,
ETO_OPAQUE | ETO_CLIPPED,
&rectEdit,
pText ? pText : empty_stringW , size, NULL );
pText ? pText : L"" , size, NULL );
if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED))
DrawFocusRect( hdc, &rectEdit );
@ -886,7 +880,6 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index )
{
INT length;
LPWSTR pText = NULL;
static const WCHAR empty_stringW[] = { 0 };
TRACE("\t %i\n", index );
@ -903,7 +896,7 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index )
if( CB_HASSTRINGS(lphc) )
{
lphc->wState |= (CBF_NOEDITNOTIFY | CBF_NOLBSELECT);
SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, pText ? (LPARAM)pText : (LPARAM)empty_stringW);
SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, pText ? (LPARAM)pText : (LPARAM)L"");
lphc->wState &= ~(CBF_NOEDITNOTIFY | CBF_NOLBSELECT);
}
@ -1959,10 +1952,7 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam
SendMessageW(lphc->hWndLBox, LB_RESETCONTENT, 0, 0);
if ((lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc))
{
static const WCHAR empty_stringW[] = { 0 };
SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)empty_stringW);
}
SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)L"");
else
InvalidateRect(lphc->self, NULL, TRUE);
return TRUE;

View File

@ -327,14 +327,13 @@ static LPCWSTR COMBOEX_GetText(const COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
static void COMBOEX_GetComboFontSize (const COMBOEX_INFO *infoPtr, SIZE *size)
{
static const WCHAR strA[] = { 'A', 0 };
HFONT nfont, ofont;
HDC mydc;
mydc = GetDC (0); /* why the entire screen???? */
nfont = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
ofont = SelectObject (mydc, nfont);
GetTextExtentPointW (mydc, strA, 1, size);
GetTextExtentPointW (mydc, L"A", 1, size);
SelectObject (mydc, ofont);
ReleaseDC (0, mydc);
TRACE("selected font hwnd=%p, height=%d\n", nfont, size->cy);
@ -948,7 +947,6 @@ static INT COMBOEX_SetItemHeight (COMBOEX_INFO const *infoPtr, INT index, UINT h
static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs)
{
static const WCHAR NIL[] = { 0 };
COMBOEX_INFO *infoPtr;
LOGFONTW mylogfont;
RECT win_rect;
@ -991,7 +989,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs)
/* We also need to place the edit control at the proper location */
/* (allow space for the icons). */
infoPtr->hwndCombo = CreateWindowW (WC_COMBOBOXW, NIL,
infoPtr->hwndCombo = CreateWindowW (WC_COMBOBOXW, L"",
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL |
CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST |
WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED |
@ -1009,7 +1007,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs)
* It is created only for CBS_DROPDOWN style
*/
if ((cs->style & CBS_DROPDOWNLIST) == CBS_DROPDOWN) {
infoPtr->hwndEdit = CreateWindowExW (0, WC_EDITW, NIL,
infoPtr->hwndEdit = CreateWindowExW (0, WC_EDITW, L"",
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL,
0, 0, 0, 0, /* will set later */
infoPtr->hwndCombo,
@ -1257,11 +1255,10 @@ static BOOL COMBOEX_WM_DeleteItem (COMBOEX_INFO *infoPtr, DELETEITEMSTRUCT const
static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *dis)
{
static const WCHAR nil[] = { 0 };
CBE_ITEMDATA *item = NULL;
SIZE txtsize;
RECT rect;
LPCWSTR str = nil;
LPCWSTR str = L"";
UINT xbase, x, y;
INT len;
COLORREF nbkc, ntxc, bkc, txc;
@ -1399,7 +1396,7 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *di
/* setup pointer to text to be drawn */
str = COMBOEX_GetText(infoPtr, item);
if (!str) str = nil;
if (!str) str = L"";
len = lstrlenW (str);
GetTextExtentPoint32W (dis->hDC, str, len, &txtsize);
@ -1537,12 +1534,11 @@ static LRESULT COMBOEX_Enable (COMBOEX_INFO *infoPtr, BOOL enable)
static LRESULT COMBOEX_MeasureItem (COMBOEX_INFO const *infoPtr, MEASUREITEMSTRUCT *mis)
{
static const WCHAR strW[] = { 'W', 0 };
SIZE mysize;
HDC hdc;
hdc = GetDC (0);
GetTextExtentPointW (hdc, strW, 1, &mysize);
GetTextExtentPointW (hdc, L"W", 1, &mysize);
ReleaseDC (0, hdc);
mis->itemHeight = mysize.cy + CBE_EXTRA;

View File

@ -93,9 +93,7 @@ static const WORD wPattern55AA[] =
0x5555, 0xaaaa, 0x5555, 0xaaaa
};
static const WCHAR strCC32SubclassInfo[] = {
'C','C','3','2','S','u','b','c','l','a','s','s','I','n','f','o',0
};
static const WCHAR strCC32SubclassInfo[] = L"CC32SubclassInfo";
static void unregister_versioned_classes(void)
{
@ -1738,7 +1736,7 @@ HRESULT WINAPI LoadIconMetric(HINSTANCE hinst, const WCHAR *name, int size, HICO
return LoadIconWithScaleDown(hinst, name, cx, cy, icon);
}
static const WCHAR strMRUList[] = { 'M','R','U','L','i','s','t',0 };
static const WCHAR strMRUList[] = L"MRUList";
/**************************************************************************
* Alloc [COMCTL32.71]

View File

@ -126,7 +126,7 @@ extern int MONTHCAL_CalculateDayOfWeek(SYSTEMTIME *date, BOOL inplace);
static BOOL DATETIME_SendSimpleNotify (const DATETIME_INFO *infoPtr, UINT code);
static BOOL DATETIME_SendDateTimeChangeNotify (const DATETIME_INFO *infoPtr);
static const WCHAR allowedformatchars[] = {'d', 'h', 'H', 'm', 'M', 's', 't', 'y', 'X', 0};
static const WCHAR allowedformatchars[] = L"dhHmMstyX";
static const int maxrepetition [] = {4,2,2,2,4,2,2,4,-1};
/* valid date limits */

View File

@ -3031,19 +3031,16 @@ static LRESULT EDIT_WM_Char(EDITSTATE *es, WCHAR c)
if (es->style & ES_READONLY) {
EDIT_MoveHome(es, FALSE, FALSE);
EDIT_MoveDown_ML(es, FALSE);
} else {
static const WCHAR cr_lfW[] = {'\r','\n'};
EDIT_EM_ReplaceSel(es, TRUE, cr_lfW, 2, TRUE, TRUE);
}
} else
EDIT_EM_ReplaceSel(es, TRUE, L"\r\n", 2, TRUE, TRUE);
}
break;
case '\t':
if ((es->style & ES_MULTILINE) && !(es->style & ES_READONLY))
{
static const WCHAR tabW[] = {'\t'};
if (EDIT_IsInsideDialog(es))
break;
EDIT_EM_ReplaceSel(es, TRUE, tabW, 1, TRUE, TRUE);
EDIT_EM_ReplaceSel(es, TRUE, L"\t", 1, TRUE, TRUE);
}
break;
case VK_BACK:

View File

@ -1690,8 +1690,7 @@ static LRESULT LISTBOX_InsertString( LB_DESCR *descr, INT index, LPCWSTR str )
if (HAS_STRINGS(descr))
{
static const WCHAR empty_stringW[] = { 0 };
if (!str) str = empty_stringW;
if (!str) str = L"";
if (!(new_str = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(str) + 1) * sizeof(WCHAR) )))
{
SEND_NOTIFICATION( descr, LBN_ERRSPACE );
@ -1881,16 +1880,14 @@ static LRESULT LISTBOX_Directory( LB_DESCR *descr, UINT attrib,
WCHAR buffer[270];
if (entry.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
static const WCHAR bracketW[] = { ']',0 };
static const WCHAR dotW[] = { '.',0 };
if (!(attrib & DDL_DIRECTORY) ||
!lstrcmpW( entry.cFileName, dotW )) continue;
!lstrcmpW( entry.cFileName, L"." )) continue;
buffer[0] = '[';
if (!long_names && entry.cAlternateFileName[0])
lstrcpyW( buffer + 1, entry.cAlternateFileName );
else
lstrcpyW( buffer + 1, entry.cFileName );
lstrcatW(buffer, bracketW);
lstrcatW(buffer, L"]");
}
else /* not a directory */
{
@ -3164,7 +3161,6 @@ void LISTBOX_Register(void)
void COMBOLBOX_Register(void)
{
static const WCHAR combolboxW[] = {'C','o','m','b','o','L','B','o','x',0};
WNDCLASSW wndClass;
memset(&wndClass, 0, sizeof(wndClass));
@ -3174,6 +3170,6 @@ void COMBOLBOX_Register(void)
wndClass.cbWndExtra = sizeof(LB_DESCR *);
wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
wndClass.hbrBackground = NULL;
wndClass.lpszClassName = combolboxW;
wndClass.lpszClassName = L"ComboLBox";
RegisterClassW(&wndClass);
}

View File

@ -422,7 +422,7 @@ typedef struct tagLISTVIEW_INFO
TRACE("hwndSelf=%p, rcList=%s\n", iP->hwndSelf, wine_dbgstr_rect(&iP->rcList)); \
} while(0)
static const WCHAR themeClass[] = {'L','i','s','t','V','i','e','w',0};
static const WCHAR themeClass[] = L"ListView";
/*
* forward declarations

View File

@ -529,7 +529,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
PROGRESS_INFO *infoPtr;
static const WCHAR themeClass[] = {'P','r','o','g','r','e','s','s',0};
static const WCHAR themeClass[] = L"Progress";
HTHEME theme;
TRACE("hwnd=%p msg=%04x wparam=%lx lParam=%lx\n", hwnd, message, wParam, lParam);

View File

@ -86,7 +86,7 @@ typedef struct
#define VERT_BORDER 2
#define HORZ_GAP 2
static const WCHAR themeClass[] = { 'S','t','a','t','u','s',0 };
static const WCHAR themeClass[] = L"Status";
/* prototype */
static void

View File

@ -145,7 +145,6 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
{
unsigned int size, title_size;
static const WORD fontsize = 0x7fff;
static const WCHAR emptyW[] = { 0 };
const WCHAR *titleW = NULL;
DLGTEMPLATE *template;
WCHAR pathW[MAX_PATH];
@ -162,7 +161,7 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
else
titleW = taskconfig->pszWindowTitle;
if (!titleW)
titleW = emptyW;
titleW = L"";
title_size = (lstrlenW(titleW) + 1) * sizeof(WCHAR);
size = sizeof(DLGTEMPLATE) + 2 * sizeof(WORD);
@ -1205,7 +1204,7 @@ static void taskdialog_destroy(struct taskdialog_info *dialog_info)
static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static const WCHAR taskdialog_info_propnameW[] = {'T','a','s','k','D','i','a','l','o','g','I','n','f','o',0};
static const WCHAR taskdialog_info_propnameW[] = L"TaskDialogInfo";
struct taskdialog_info *dialog_info;
LRESULT result;

View File

@ -40,7 +40,7 @@ LRESULT CALLBACK THEMING_DialogSubclassProc (HWND hWnd, UINT msg,
ULONG_PTR dwRefData)
{
HTHEME theme = GetWindowTheme ( hWnd );
static const WCHAR themeClass[] = { 'W','i','n','d','o','w',0 };
static const WCHAR themeClass[] = L"Window";
BOOL themingActive = IsThemeDialogTextureEnabled (hWnd);
BOOL doTheming = themingActive && (theme != NULL);
LRESULT result;

View File

@ -39,7 +39,7 @@ extern LRESULT CALLBACK THEMING_DialogSubclassProc (HWND, UINT, WPARAM, LPARAM,
extern LRESULT CALLBACK THEMING_ScrollbarSubclassProc (HWND, UINT, WPARAM, LPARAM,
ULONG_PTR) DECLSPEC_HIDDEN;
static const WCHAR dialogClass[] = {'#','3','2','7','7','0',0};
static const WCHAR dialogClass[] = L"#32770";
static const struct ThemingSubclass
{
@ -95,15 +95,11 @@ static const WNDPROC subclassProcs[NUM_SUBCLASSES] = {
void THEMING_Initialize (void)
{
unsigned int i;
static const WCHAR subclassPropName[] =
{ 'C','C','3','2','T','h','e','m','i','n','g','S','u','b','C','l',0 };
static const WCHAR refDataPropName[] =
{ 'C','C','3','2','T','h','e','m','i','n','g','D','a','t','a',0 };
if (!IsThemeActive()) return;
atSubclassProp = GlobalAddAtomW (subclassPropName);
atRefDataProp = GlobalAddAtomW (refDataPropName);
atSubclassProp = GlobalAddAtomW (L"CC32ThemingSubCl");
atRefDataProp = GlobalAddAtomW (L"CC32ThemingData");
for (i = 0; i < NUM_SUBCLASSES; i++)
{

View File

@ -232,7 +232,7 @@ typedef enum
#define GETHOTIMAGELIST(infoPtr, id) TOOLBAR_GetImageList(infoPtr->himlHot, infoPtr->cimlHot, id)
#define GETDISIMAGELIST(infoPtr, id) TOOLBAR_GetImageList(infoPtr->himlDis, infoPtr->cimlDis, id)
static const WCHAR themeClass[] = { 'T','o','o','l','b','a','r',0 };
static const WCHAR themeClass[] = L"Toolbar";
static BOOL TOOLBAR_GetButtonInfo(const TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb);
static BOOL TOOLBAR_IsButtonRemovable(const TOOLBAR_INFO *infoPtr, int iItem, const CUSTOMBUTTON *btnInfo);

View File

@ -97,7 +97,7 @@ typedef struct
#define TIC_SELECTIONMARKMIN 0x100
#define TIC_SELECTIONMARK (TIC_SELECTIONMARKMAX | TIC_SELECTIONMARKMIN)
static const WCHAR themeClass[] = { 'T','r','a','c','k','b','a','r',0 };
static const WCHAR themeClass[] = L"Trackbar";
static inline int
notify_customdraw (const TRACKBAR_INFO *infoPtr, NMCUSTOMDRAW *pnmcd, int stage)
@ -851,7 +851,6 @@ static void
TRACKBAR_UpdateToolTip (const TRACKBAR_INFO *infoPtr)
{
WCHAR buf[80];
static const WCHAR fmt[] = { '%', 'l', 'd', 0 };
TTTOOLINFOW ti;
POINT pt;
RECT rcClient;
@ -864,7 +863,7 @@ TRACKBAR_UpdateToolTip (const TRACKBAR_INFO *infoPtr)
ti.hwnd = infoPtr->hwndSelf;
ti.uFlags = TTF_IDISHWND | TTF_TRACK | TTF_ABSOLUTE;
wsprintfW (buf, fmt, infoPtr->lPos);
wsprintfW (buf, L"%ld", infoPtr->lPos);
ti.lpszText = buf;
SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);

View File

@ -200,7 +200,7 @@ typedef struct _TREEITEM /* HTREEITEM is a _TREEINFO *. */
#define GETTXTCOLOR(x) ((x) == CLR_NONE ? comctl32_color.clrWindowText : (x))
#define GETINSCOLOR(x) ((x) == CLR_DEFAULT ? comctl32_color.clrBtnText : (x))
static const WCHAR themeClass[] = { 'T','r','e','e','v','i','e','w',0 };
static const WCHAR themeClass[] = L"Treeview";
typedef VOID (*TREEVIEW_ItemEnumFunc)(TREEVIEW_INFO *, TREEVIEW_ITEM *,LPVOID);

View File

@ -306,8 +306,6 @@ static BOOL UPDOWN_GetBuddyInt (UPDOWN_INFO *infoPtr)
*/
static BOOL UPDOWN_SetBuddyInt (const UPDOWN_INFO *infoPtr)
{
static const WCHAR fmt_hex[] = { '0', 'x', '%', '0', '4', 'X', 0 };
static const WCHAR fmt_dec_oct[] = { '%', 'd', '\0' };
const WCHAR *fmt;
WCHAR txt[20], txt_old[20] = { 0 };
int len;
@ -323,7 +321,7 @@ static BOOL UPDOWN_SetBuddyInt (const UPDOWN_INFO *infoPtr)
}
/* Regular window, so set caption to the number */
fmt = (infoPtr->Base == 16) ? fmt_hex : fmt_dec_oct;
fmt = (infoPtr->Base == 16) ? L"0x%04X" : L"%d";
len = wsprintfW(txt, fmt, infoPtr->CurVal);
@ -892,7 +890,6 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT
static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);
static const WCHAR themeClass[] = {'S','p','i','n',0};
HTHEME theme;
TRACE("hwnd=%p msg=%04x wparam=%08lx lparam=%08lx\n", hwnd, message, wParam, lParam);
@ -932,7 +929,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
if (infoPtr->dwStyle & UDS_AUTOBUDDY)
UPDOWN_SetBuddy (infoPtr, GetWindow (hwnd, GW_HWNDPREV));
OpenThemeData (hwnd, themeClass);
OpenThemeData (hwnd, L"Spin");
TRACE("UpDown Ctrl creation, hwnd=%p\n", hwnd);
}
@ -968,7 +965,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
case WM_THEMECHANGED:
theme = GetWindowTheme (hwnd);
CloseThemeData (theme);
OpenThemeData (hwnd, themeClass);
OpenThemeData (hwnd, L"Spin");
InvalidateRect (hwnd, NULL, FALSE);
break;