设为首页 加入收藏

TOP

VC制作类似于IE4的酷工具条(二)
2014-11-23 20:01:12 】 浏览:450
Tags:制作 类似 IE4 工具
AK);

return 0;
}

到此,运行程序,已经可以看到一个类似IE4.0的程序出来了。但是下拉式图标按钮并没有显示出下拉菜单,也没有对输入框进行消息响应。继续修改程序如下:

5. 制作菜单IDR_PRINT_POPUP
6. 在MainFrame.h加入
afx_msg void OnDropDown(NMHDR* pNotifyStruct, LRESULT* pResult);
在MainFrame.cpp中的MESSAGE_MAP加入消息映射
ON_NOTIFY(TBN_DROPDOWN, AFX_IDW_TOOLBAR, OnDropDown)
和处理函数体:
void CMainFrame::OnDropDown(NMHDR* pNotifyStruct, LRESULT* pResult)
{
// this function handles the dropdown menus from the toolbar
NMTOOLBAR* pNMToolBar = (NMTOOLBAR*)pNotifyStruct;
CRect rect;

// translate the current toolbar item rectangle into screen coordinates
// so that well know where to pop up the menu
m_wndToolBar.GetToolBarCtrl().GetRect(pNMToolBar->iItem, &rect);
rect.top = rect.bottom;
::ClientToScreen(pNMToolBar->hdr.hwndFrom, &rect.TopLeft());
if(pNMToolBar->iItem == ID_FILE_PRINT_SETUP)
{
CMenu menu;
CMenu* pPopup;

// the font popup is stored in a resource
menu.LoadMenu(IDR_PRINT_POPUP);
pPopup = menu.GetSubMenu(0);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, rect.left, rect.top + 1, AfxGetMainWnd());
}
*pResult = TBDDRET_DEFAULT;
}

7. 处理对Combox的响应,这里只对内容改变的消息进行处理,若要添加别的处理,参看Combo Box Handlers的消息映射。
在MainFrame.h中加入 afx_msg void OnNewAddress();
在MainFrame.cpp中的MESSAGE_MAP中加入消
首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇VC++中的一个不足及其改善方法 下一篇用Visual C++开发数据库程序

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目