RT
有什么简单的方法吗?不使用MFC
有什么简单的方法吗?不使用MFC
解决方案 »
- 关于从编辑框里面把数据读取到数据库的问题
- 100分求广海注册邀请码
- 谁知道WSASend发送返回成功或者返回ERROR_IO_PENDING后数据是否完全发送完毕?
- 如何修改CListCtrl控件Report样式下的表头颜色(再现等待)
- ★升星散分,祝大家猴年吉祥!!!
- 请各位做图像处理的兄弟来说说自己的薪水,大家都是做这个的,彼此做个参考
- sdk问题,自画按钮。
- 请教一个关于list control显示 的问题,谢谢
- 急求解答:小弟在自己编写的Dll中,用loadlibrary调用另一个Dll,调试运行到LoadLibrary的时候,出现Access Violation错误!
- 20分请大侠看看:无法安装vc: 运行setup, 再点下步,就报错了!详见内!
- 倾家荡产!只为求得一个答案!
- VC的就业方向?
// buttons to it.
// Returns the handle to the toolbar if successful, or NULL otherwise.
// hwndParent - handle to the parent window.
HWND CreateAToolBar(HWND hwndParent)
{
HWND hwndTB;
TBADDBITMAP tbab;
TBBUTTON tbb[3];
char szBuf[16];
int iCut, iCopy, iPaste;
// Ensure that the common control DLL is loaded.
InitCommonControls();
// Create a toolbar that the user can customize and that has a
// tooltip associated with it.
hwndTB = CreateWindowEx(0, TOOLBARCLASSNAME, (LPSTR) NULL,
WS_CHILD | TBSTYLE_TOOLTIPS | CCS_ADJUSTABLE,
0, 0, 0, 0, hwndParent, (HMENU) ID_TOOLBAR, g_hinst, NULL);
// Send the TB_BUTTONSTRUCTSIZE message, which is required for
// backward compatibility.
SendMessage(hwndTB, TB_BUTTONSTRUCTSIZE,
(WPARAM) sizeof(TBBUTTON), 0);
// Add the bitmap containing button images to the toolbar.
tbab.hInst = g_hinst;
tbab.nID = IDB_BUTTONS;
SendMessage(hwndTB, TB_ADDBITMAP, (WPARAM) NUM_BUTTON_BITMAPS,
(WPARAM) &tbab);
// Add the button strings to the toolbar.
LoadString(g_hinst, IDS_CUT, (LPSTR) &szBuf, MAX_LEN);
iCut = SendMessage(hwndTB, TB_ADDSTRING, 0, (LPARAM) (LPSTR) szBuf);
LoadString(g_hinst, IDS_COPY, (LPSTR) &szBuf, MAX_LEN);
iCopy = SendMessage(hwndTB, TB_ADDSTRING, (WPARAM) 0,
(LPARAM) (LPSTR) szBuf);
LoadString(g_hinst, IDS_PASTE, (LPSTR) &szBuf, MAX_LEN);
iPaste = SendMessage(hwndTB, TB_ADDSTRING, (WPARAM) 0,
(LPARAM) (LPSTR) szBuf);
// Fill the TBBUTTON array with button information, and add the
// buttons to the toolbar.
tbb[0].iBitmap = BMP_CUT;
tbb[0].idCommand = IDM_CUT;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_BUTTON;
tbb[0].dwData = 0;
tbb[0].iString = iCut;
tbb[1].iBitmap = BMP_COPY;
tbb[1].idCommand = IDM_COPY;
tbb[1].fsState = TBSTATE_ENABLED;
tbb[1].fsStyle = TBSTYLE_BUTTON;
tbb[1].dwData = 0;
tbb[1].iString = iCopy;
tbb[2].iBitmap = BMP_PASTE;
tbb[2].idCommand = IDM_PASTE;
tbb[2].fsState = TBSTATE_ENABLED;
tbb[2].fsStyle = TBSTYLE_BUTTON;
tbb[2].dwData = 0;
tbb[2].iString = iPaste;
SendMessage(hwndTB, TB_ADDBUTTONS, (WPARAM) NUM_BUTTONS,
(LPARAM) (LPTBBUTTON) &tbb);
SendMessage(hwndTB, TB_AUTOSIZE, 0, 0); ShowWindow(hwndTB, SW_SHOW);
return hwndTB;
}总之用SDK是比较费事的
另一方面我觉得Toolbar本身作为一种Windows资源没有理由没有直接载入和操作接口吧!