shell32/shellview: Use W-calls for menu handling, same for SendMessage to ListView window.

This commit is contained in:
Nikolay Sivov 2010-03-06 23:48:34 +03:00 committed by Alexandre Julliard
parent 571159d5ff
commit 5308dfb396

View File

@ -683,6 +683,7 @@ static HRESULT ShellView_FillList(IShellViewImpl *This)
static LRESULT ShellView_OnCreate(IShellViewImpl *This) static LRESULT ShellView_OnCreate(IShellViewImpl *This)
{ {
IShellView2 *iface = (IShellView2*)This; IShellView2 *iface = (IShellView2*)This;
static const WCHAR accel_nameW[] = {'s','h','v','_','a','c','c','e','l',0};
IPersistFolder2 *ppf2; IPersistFolder2 *ppf2;
IDropTarget* pdt; IDropTarget* pdt;
HRESULT hr; HRESULT hr;
@ -721,7 +722,7 @@ static LRESULT ShellView_OnCreate(IShellViewImpl *This)
IPersistFolder2_Release(ppf2); IPersistFolder2_Release(ppf2);
} }
This->hAccel = LoadAcceleratorsA(shell32_hInstance, "shv_accel"); This->hAccel = LoadAcceleratorsW(shell32_hInstance, accel_nameW);
return S_OK; return S_OK;
} }
@ -777,26 +778,31 @@ static HMENU ShellView_BuildFileMenu(IShellViewImpl * This)
* ShellView_MergeFileMenu() * ShellView_MergeFileMenu()
*/ */
static void ShellView_MergeFileMenu(IShellViewImpl *This, HMENU hSubMenu) static void ShellView_MergeFileMenu(IShellViewImpl *This, HMENU hSubMenu)
{ TRACE("(%p)->(submenu=%p) stub\n",This,hSubMenu); {
TRACE("(%p)->(submenu=%p) stub\n",This,hSubMenu);
if (hSubMenu) if (hSubMenu)
{ /*insert This item at the beginning of the menu */ {
MENUITEMINFOA mii; static const WCHAR dummyW[] = {'d','u','m','m','y','4','5',0};
MENUITEMINFOW mii;
/* insert This item at the beginning of the menu */
mii.cbSize = sizeof(mii); mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE; mii.fMask = MIIM_ID | MIIM_TYPE;
mii.wID = 0; mii.wID = 0;
mii.fType = MFT_SEPARATOR; mii.fType = MFT_SEPARATOR;
InsertMenuItemA(hSubMenu, 0, TRUE, &mii); InsertMenuItemW(hSubMenu, 0, TRUE, &mii);
mii.cbSize = sizeof(mii); mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE; mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.dwTypeData = (LPSTR)"dummy45"; mii.dwTypeData = (LPWSTR)dummyW;
mii.fState = MFS_ENABLED; mii.fState = MFS_ENABLED;
mii.wID = IDM_MYFILEITEM; mii.wID = IDM_MYFILEITEM;
mii.fType = MFT_STRING; mii.fType = MFT_STRING;
InsertMenuItemA(hSubMenu, 0, TRUE, &mii); InsertMenuItemW(hSubMenu, 0, TRUE, &mii);
} }
TRACE("--\n"); TRACE("--\n");
} }
@ -808,24 +814,26 @@ static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu)
{ {
TRACE("(%p)->(submenu=%p)\n",This,hSubMenu); TRACE("(%p)->(submenu=%p)\n",This,hSubMenu);
/* add a separator at the correct position in the menu */
if (hSubMenu) if (hSubMenu)
{ /*add a separator at the correct position in the menu*/ {
MENUITEMINFOA mii; static const WCHAR menuW[] = {'M','E','N','U','_','0','0','1',0};
static char view[] = "View"; static const WCHAR viewW[] = {'V','i','e','w',0};
MENUITEMINFOW mii;
ZeroMemory(&mii, sizeof(mii)); memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii); mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE; mii.fMask = MIIM_ID | MIIM_TYPE;
mii.wID = 0; mii.wID = 0;
mii.fType = MFT_SEPARATOR; mii.fType = MFT_SEPARATOR;
InsertMenuItemA(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii); InsertMenuItemW(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
mii.cbSize = sizeof(mii); mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA; mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;
mii.fType = MFT_STRING; mii.fType = MFT_STRING;
mii.dwTypeData = view; mii.dwTypeData = (LPWSTR)viewW;
mii.hSubMenu = LoadMenuA(shell32_hInstance, "MENU_001"); mii.hSubMenu = LoadMenuW(shell32_hInstance, menuW);
InsertMenuItemA(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii); InsertMenuItemW(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
} }
} }
@ -1117,17 +1125,14 @@ static void ShellView_OnDeactivate(IShellViewImpl * This)
* ShellView_OnActivate() * ShellView_OnActivate()
*/ */
static LRESULT ShellView_OnActivate(IShellViewImpl *This, UINT uState) static LRESULT ShellView_OnActivate(IShellViewImpl *This, UINT uState)
{ OLEMENUGROUPWIDTHS omw = { {0, 0, 0, 0, 0, 0} }; {
MENUITEMINFOA mii; OLEMENUGROUPWIDTHS omw = { {0, 0, 0, 0, 0, 0} };
CHAR szText[MAX_PATH]; MENUITEMINFOW mii;
TRACE("%p uState=%x\n",This,uState); TRACE("(%p) uState=%x\n",This,uState);
/* don't do anything if the state isn't really changing */ /* don't do anything if the state isn't really changing */
if(This->uState == uState) if (This->uState == uState) return S_OK;
{
return S_OK;
}
ShellView_OnDeactivate(This); ShellView_OnDeactivate(This);
@ -1139,49 +1144,49 @@ static LRESULT ShellView_OnActivate(IShellViewImpl * This, UINT uState)
if (This->hMenu) if (This->hMenu)
{ {
static const WCHAR dummyW[] = {'d','u','m','m','y',' ','3','1',0};
IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw); IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw);
TRACE("-- after fnInsertMenusSB\n"); TRACE("-- after fnInsertMenusSB\n");
/*build the top level menu get the menu item's text*/
strcpy(szText,"dummy 31");
ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii); mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE; mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE;
mii.fType = MFT_STRING; mii.fType = MFT_STRING;
mii.fState = MFS_ENABLED; mii.fState = MFS_ENABLED;
mii.dwTypeData = szText; mii.wID = 0;
mii.hSubMenu = ShellView_BuildFileMenu(This); mii.hSubMenu = ShellView_BuildFileMenu(This);
mii.hbmpChecked = NULL;
mii.hbmpUnchecked = NULL;
mii.dwItemData = 0;
/* build the top level menu get the menu item's text */
mii.dwTypeData = (LPWSTR)dummyW;
mii.cch = 0;
mii.hbmpItem = NULL;
/* insert our menu into the menu bar */ /* insert our menu into the menu bar */
if (mii.hSubMenu) if (mii.hSubMenu)
{ InsertMenuItemW(This->hMenu, FCIDM_MENU_HELP, FALSE, &mii);
InsertMenuItemA(This->hMenu, FCIDM_MENU_HELP, FALSE, &mii);
}
/* get the view menu so we can merge with it */ /* get the view menu so we can merge with it */
ZeroMemory(&mii, sizeof(mii)); memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii); mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU; mii.fMask = MIIM_SUBMENU;
if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_VIEW, FALSE, &mii)) if (GetMenuItemInfoW(This->hMenu, FCIDM_MENU_VIEW, FALSE, &mii))
{
ShellView_MergeViewMenu(This, mii.hSubMenu); ShellView_MergeViewMenu(This, mii.hSubMenu);
}
/* add the items that should only be added if we have the focus */ /* add the items that should only be added if we have the focus */
if (SVUIA_ACTIVATE_FOCUS == uState) if (SVUIA_ACTIVATE_FOCUS == uState)
{ {
/* get the file menu so we can merge with it */ /* get the file menu so we can merge with it */
ZeroMemory(&mii, sizeof(mii)); memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii); mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU; mii.fMask = MIIM_SUBMENU;
if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_FILE, FALSE, &mii)) if (GetMenuItemInfoW(This->hMenu, FCIDM_MENU_FILE, FALSE, &mii))
{
ShellView_MergeFileMenu(This, mii.hSubMenu); ShellView_MergeFileMenu(This, mii.hSubMenu);
} }
}
TRACE("-- before fnSetMenuSB\n"); TRACE("-- before fnSetMenuSB\n");
IShellBrowser_SetMenuSB(This->pShellBrowser, This->hMenu, 0, This->hWnd); IShellBrowser_SetMenuSB(This->pShellBrowser, This->hMenu, 0, This->hWnd);
} }
@ -1273,7 +1278,7 @@ static LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dw
This->ListViewSortInfo.nHeaderID = dwCmdID - 0x30; This->ListViewSortInfo.nHeaderID = dwCmdID - 0x30;
This->ListViewSortInfo.bIsAscending = TRUE; This->ListViewSortInfo.bIsAscending = TRUE;
This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID; This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID;
SendMessageA(This->hWndList, LVM_SORTITEMS, (WPARAM) &This->ListViewSortInfo, (LPARAM)ShellView_ListViewCompareItems); SendMessageW(This->hWndList, LVM_SORTITEMS, (WPARAM) &This->ListViewSortInfo, (LPARAM)ShellView_ListViewCompareItems);
break; break;
default: default:
@ -1548,7 +1553,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
MAKELPARAM (LVNI_SELECTED, 0)); MAKELPARAM (LVNI_SELECTED, 0));
item.iItem = item_index; item.iItem = item_index;
item.mask = LVIF_PARAM; item.mask = LVIF_PARAM;
SendMessageA(This->hWndList, LVM_GETITEMA, 0, (LPARAM) &item); SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &item);
/* get item pidl */ /* get item pidl */
pItems[i] = (LPITEMIDLIST)item.lParam; pItems[i] = (LPITEMIDLIST)item.lParam;
@ -1655,7 +1660,7 @@ static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wPara
case WM_SHOWWINDOW: UpdateWindow(pThis->hWndList); case WM_SHOWWINDOW: UpdateWindow(pThis->hWndList);
break; break;
case WM_GETDLGCODE: return SendMessageA(pThis->hWndList,uMessage,0,0); case WM_GETDLGCODE: return SendMessageW(pThis->hWndList, uMessage, 0, 0);
case WM_DESTROY: case WM_DESTROY:
RevokeDragDrop(pThis->hWnd); RevokeDragDrop(pThis->hWnd);