I am trying to create a toolbar under MSVC 5.0. Below I have included some code that I am using. It creates the toolbar and displays it, but the buttons will not work because there is no command handlers for them. I am not sure how to attach command handlers to these buttons. I will describe the process I used to develop this toolbar.
Step 1: I went to resources and inserted a toolbar resouce. I then created three buttons. The Buttons are push buttons.
Step 2: In DMainFrame.h I declared CToolBar *d_pToolbar2;
Step 3: In DMainFrame.cpp I added the following code to DMainFrame::OnCreate function.
d_pToolbar2 = new CToolBar();
//Loads ToolBar From Resouces
//Displays ToolBar In Application
Step 4: Build Program and execute. The program will display the toolbar, but I need to attach the buttons to some kind of command handler.
Here are my Questions
Q1: I would like the buttons to be represented as ID_TESTBUTTON_ONE, ID_TESTBUTTON_TWO, ID_TESTBUTTON_THREE. Where do I set these properties for that toolbar?
Q2: In This book I have it shows creating some code like the following
static UINT BASED_CODE buttons =
//list toolbar buttons as IDs
I added this code, and added the buttons with the IDs I want, but to be expected it said the buttons were undeclared identifiers?
Q3: In this line of code that does the 0x9100 do / stand for in this call?
Q4: What do I do next? Am I on the right track. How can I finish this off.
Thank you for your time..