读书人

如何用sdk的方法添加工具条

发布时间: 2012-02-24 16:30:39 作者: rapoo

怎么用sdk的方法添加工具条
我的开发环境是vc++6.0 win32 Appliction

[解决办法]
TBBUTTON tbButton[NUMBUTTONS];
HWND tbwnd; //toolbar handle

tbButton[0].idCommand=IDM_LINES;
tbButton[0].fsState=TBSTATE_ENABLED;
tbButton[0].fsStyle=TBSTYLE_BUTTON;
tbButton[0].dwData=0l;
tbButton[0].iBitmap=0;
tbButton[0].iString=0;

tbButton[1].idCommand=IDM_RECTANGLES;
tbButton[1].fsState=TBSTATE_ENABLED;
tbButton[1].fsStyle=TBSTYLE_BUTTON;
tbButton[1].dwData=0l;
tbButton[1].iBitmap=1;
tbButton[1].iString=0;

tbButton[2].idCommand=IDM_ELLIPSES;
tbButton[2].fsState=TBSTATE_ENABLED;
tbButton[2].fsStyle=TBSTYLE_BUTTON;
tbButton[2].dwData=0l;
tbButton[2].iBitmap=2;
tbButton[2].iString=0;

tbButton[3].idCommand=IDM_RESET;
tbButton[3].fsState=TBSTATE_ENABLED;
tbButton[3].fsStyle=TBSTYLE_BUTTON;
tbButton[3].dwData=0l;
tbButton[3].iBitmap=3;
tbButton[3].iString=0;

//button separator
tbButton[4].idCommand=0;
tbButton[4].fsState=TBSTATE_ENABLED;
tbButton[4].fsStyle=TBSTYLE_SEP;
tbButton[4].dwData=0l;
tbButton[4].iBitmap=0;
tbButton[4].iString=0;

tbButton[5].idCommand=IDM_HELP;
tbButton[5].fsState=TBSTATE_ENABLED;
tbButton[5].fsStyle=TBSTYLE_BUTTON;
tbButton[5].dwData=0l;
tbButton[5].iBitmap=5;
tbButton[5].iString=0;

tbwnd=CreateToolbarEx(hwnd,
WS_VISIBLE|WS_CHILD|WS_BORDER|TBSTYLE_TOOLTIPS,
IDM_TOOLBAR,
NUMBUTTONS,
hThisInst,
IDTB_BMP,
tbButton,
NUMBUTTONS,
16,16,16,16,
sizeof(TBBUTTON));

[解决办法]
TBBUTTON tbButton[NUMBUTTONS];
HWND tbwnd; //toolbar handle

tbButton[0].idCommand=IDM_LINES;
tbButton[0].fsState=TBSTATE_ENABLED;
tbButton[0].fsStyle=TBSTYLE_BUTTON;
tbButton[0].dwData=0l;
tbButton[0].iBitmap=0;
tbButton[0].iString=0;

tbButton[1].idCommand=IDM_RECTANGLES;
tbButton[1].fsState=TBSTATE_ENABLED;
tbButton[1].fsStyle=TBSTYLE_BUTTON;
tbButton[1].dwData=0l;
tbButton[1].iBitmap=1;
tbButton[1].iString=0;

tbButton[2].idCommand=IDM_ELLIPSES;
tbButton[2].fsState=TBSTATE_ENABLED;
tbButton[2].fsStyle=TBSTYLE_BUTTON;
tbButton[2].dwData=0l;
tbButton[2].iBitmap=2;
tbButton[2].iString=0;

tbButton[3].idCommand=IDM_RESET;
tbButton[3].fsState=TBSTATE_ENABLED;
tbButton[3].fsStyle=TBSTYLE_BUTTON;
tbButton[3].dwData=0l;
tbButton[3].iBitmap=3;
tbButton[3].iString=0;

//button separator
tbButton[4].idCommand=0;
tbButton[4].fsState=TBSTATE_ENABLED;
tbButton[4].fsStyle=TBSTYLE_SEP;
tbButton[4].dwData=0l;
tbButton[4].iBitmap=0;
tbButton[4].iString=0;

tbButton[5].idCommand=IDM_HELP;
tbButton[5].fsState=TBSTATE_ENABLED;
tbButton[5].fsStyle=TBSTYLE_BUTTON;
tbButton[5].dwData=0l;
tbButton[5].iBitmap=5;
tbButton[5].iString=0;



tbwnd=CreateToolbarEx(hwnd,
WS_VISIBLE|WS_CHILD|WS_BORDER|TBSTYLE_TOOLTIPS,
IDM_TOOLBAR,
NUMBUTTONS,
hThisInst,
IDTB_BMP,
tbButton,
NUMBUTTONS,
16,16,16,16,
sizeof(TBBUTTON));


[解决办法]
用CreateWindow就可以了,MSDN里有例子,自己看就行了。
[解决办法]
CreateToolbarEx

MSDN 这个API 的参数及其使用方法

读书人网 >C++

热点推荐