|
sp; hr = pCmdTarget->Exec( &::CGID_ShellDocView, CmdID_GetMimeSubMenu, OLECMDEXECOPT_DODEFAULT, NULL, &varEncSubMenu );
if ( SUCCEEDED( hr ) )
{
// 添加“编码”菜单
MENUITEMINFO miiEncoding;
::memset( &miiEncoding, 0, sizeof(MENUITEMINFO) );
miiEncoding.cbSize = sizeof(MENUITEMINFO);
miiEncoding.fMask = MIIM_SUBMENU;
miiEncoding.hSubMenu = reinterpret_cast< HMENU > (varEncSubMenu.byref);
menu.SetMenuItemInfo(0, &miiEncoding, TRUE);//丢掉设计时占位用的菜单,替换为“编码”菜单
}
}
}
}
pPopup = menu.GetSubMenu( 0 );
break;
}
......
}
if ( pPopup != 0 )
{
CRect rc;
::SendMessage( pNMToolBar->hdr.hwndFrom, TB_GETRECT, pNMToolBar->iItem, ( LPARAM )&rc );
rc.top = rc.bottom;
::ClientToScreen( pNMToolBar->hdr.hwndFrom, &rc.TopLeft() );
long lResult = pPopup->TrackPopupMenu( TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD, rc.left, rc.top, this );
m_bIsEncodMenuPopup = false;
if ( pNMToolBar->iItem == ID_VIEW_ENCODE )
{
//其余的事教给浏览器去做,参考《Internet Explorer 编程简述(五)调用IE隐藏的命令(中文版)》
CFindIEWnd FindIEWnd( pView->m_wndBrowser.m_hWnd, "Internet Explorer_Server");
::SendMessage( FindIEWnd.m_hWnd, WM_COMMAND, MAKEWPARAM(LOWORD(lResult), 0x0), 0 );
}
else
{
SendMessage( WM_COMMAND, MAKEWPARAM(LOWORD(lResult), 0x0), 0 );
}
}
*pResult = TBDDRET_DEFAULT;
}
void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
{
CMDIFrameWndEx::OnInitMenuPopup( 上一页 [1] [2] [3] 下一页 [聊天工具]用Windows98第二版直接共享Internet [系统软件]Internet Explorer 编程简述(繁体版) [系统软件]单击链接后无法打开新的 Internet Explorer 窗口或… [系统软件]delphi2005帮助系统使用了microsoft document exp… [系统软件]对Internet Explorer Web 控件做一点修改 [系统软件]OLE with the internet explorer [系统软件]打造个性化的Internet Explorer [系统软件]3dMax导出.x文件以及3D Explorer [常用软件]微软Internet Explorer 8最新动向 [常用软件]PDF全能管家——PDFExplorer
|