regedit: Convert listview init to unicode.
This commit is contained in:
parent
fef3660024
commit
d0991c92d7
@ -240,15 +240,15 @@ static BOOL InitListViewImageList(HWND hWndListView)
|
|||||||
if (!himl)
|
if (!himl)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
hicon = LoadImage(hInst, MAKEINTRESOURCE(IDI_STRING),
|
hicon = LoadImageW(hInst, MAKEINTRESOURCEW(IDI_STRING),
|
||||||
IMAGE_ICON, cx, cy, LR_DEFAULTCOLOR);
|
IMAGE_ICON, cx, cy, LR_DEFAULTCOLOR);
|
||||||
Image_String = ImageList_AddIcon(himl, hicon);
|
Image_String = ImageList_AddIcon(himl, hicon);
|
||||||
|
|
||||||
hicon = LoadImage(hInst, MAKEINTRESOURCE(IDI_BIN),
|
hicon = LoadImageW(hInst, MAKEINTRESOURCEW(IDI_BIN),
|
||||||
IMAGE_ICON, cx, cy, LR_DEFAULTCOLOR);
|
IMAGE_ICON, cx, cy, LR_DEFAULTCOLOR);
|
||||||
Image_Binary = ImageList_AddIcon(himl, hicon);
|
Image_Binary = ImageList_AddIcon(himl, hicon);
|
||||||
|
|
||||||
SendMessage( hWndListView, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM) himl );
|
SendMessageW( hWndListView, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM) himl );
|
||||||
|
|
||||||
/* fail if some of the icons failed to load */
|
/* fail if some of the icons failed to load */
|
||||||
if (ImageList_GetImageCount(himl) < 2)
|
if (ImageList_GetImageCount(himl) < 2)
|
||||||
@ -259,9 +259,9 @@ static BOOL InitListViewImageList(HWND hWndListView)
|
|||||||
|
|
||||||
static BOOL CreateListColumns(HWND hWndListView)
|
static BOOL CreateListColumns(HWND hWndListView)
|
||||||
{
|
{
|
||||||
TCHAR szText[50];
|
WCHAR szText[50];
|
||||||
int index;
|
int index;
|
||||||
LV_COLUMN lvC;
|
LVCOLUMNW lvC;
|
||||||
|
|
||||||
/* Create columns. */
|
/* Create columns. */
|
||||||
lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
|
lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
|
||||||
@ -272,8 +272,8 @@ static BOOL CreateListColumns(HWND hWndListView)
|
|||||||
lvC.iSubItem = index;
|
lvC.iSubItem = index;
|
||||||
lvC.cx = default_column_widths[index];
|
lvC.cx = default_column_widths[index];
|
||||||
lvC.fmt = column_alignment[index];
|
lvC.fmt = column_alignment[index];
|
||||||
LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText)/sizeof(TCHAR));
|
LoadStringW(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText)/sizeof(WCHAR));
|
||||||
if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) return FALSE;
|
if (ListView_InsertColumnW(hWndListView, index, &lvC) == -1) return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -493,6 +493,7 @@ HWND CreateListView(HWND hwndParent, UINT id)
|
|||||||
{
|
{
|
||||||
RECT rcClient;
|
RECT rcClient;
|
||||||
HWND hwndLV;
|
HWND hwndLV;
|
||||||
|
WCHAR ListView[] = {'L','i','s','t',' ','V','i','e','w',0};
|
||||||
|
|
||||||
/* prepare strings */
|
/* prepare strings */
|
||||||
LoadString(hInst, IDS_REGISTRY_VALUE_NOT_SET, g_szValueNotSet, COUNT_OF(g_szValueNotSet));
|
LoadString(hInst, IDS_REGISTRY_VALUE_NOT_SET, g_szValueNotSet, COUNT_OF(g_szValueNotSet));
|
||||||
@ -500,17 +501,17 @@ HWND CreateListView(HWND hwndParent, UINT id)
|
|||||||
|
|
||||||
/* Get the dimensions of the parent window's client area, and create the list view control. */
|
/* Get the dimensions of the parent window's client area, and create the list view control. */
|
||||||
GetClientRect(hwndParent, &rcClient);
|
GetClientRect(hwndParent, &rcClient);
|
||||||
hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, _T("List View"),
|
hwndLV = CreateWindowExW(WS_EX_CLIENTEDGE, WC_LISTVIEWW, ListView,
|
||||||
WS_VISIBLE | WS_CHILD | WS_TABSTOP | LVS_REPORT | LVS_EDITLABELS,
|
WS_VISIBLE | WS_CHILD | WS_TABSTOP | LVS_REPORT | LVS_EDITLABELS,
|
||||||
0, 0, rcClient.right, rcClient.bottom,
|
0, 0, rcClient.right, rcClient.bottom,
|
||||||
hwndParent, (HMENU)ULongToHandle(id), hInst, NULL);
|
hwndParent, (HMENU)ULongToHandle(id), hInst, NULL);
|
||||||
if (!hwndLV) return NULL;
|
if (!hwndLV) return NULL;
|
||||||
SendMessage(hwndLV, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
|
SendMessageW(hwndLV, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
|
||||||
|
|
||||||
/* Initialize the image list */
|
/* Initialize the image list */
|
||||||
if (!InitListViewImageList(hwndLV)) goto fail;
|
if (!InitListViewImageList(hwndLV)) goto fail;
|
||||||
if (!CreateListColumns(hwndLV)) goto fail;
|
if (!CreateListColumns(hwndLV)) goto fail;
|
||||||
g_orgListWndProc = (WNDPROC) SetWindowLongPtr(hwndLV, GWLP_WNDPROC, (LPARAM)ListWndProc);
|
g_orgListWndProc = (WNDPROC) SetWindowLongPtrW(hwndLV, GWLP_WNDPROC, (LPARAM)ListWndProc);
|
||||||
return hwndLV;
|
return hwndLV;
|
||||||
fail:
|
fail:
|
||||||
DestroyWindow(hwndLV);
|
DestroyWindow(hwndLV);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user