Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Toolbars with MS VC++ Resource Editor

Status
Not open for further replies.

simmeone

Programmer
Mar 16, 2000
29
DE
Hi there,

I have a question: I create a toolbar with the CreateToolbarEx function, so I want to create Toolbars with the MS VC++ 6.0 Resource Editor.
How I can call the Toolbar, that I have create with the resource editor, in my source code ?

Thanks for your help

SiM [sig][/sig]
 

Hello SiM,

This is the way the wizard does it if you start an MDI app.

CToolBar m_wndToolBar;

if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
}

IDR_MAINFRAME would be replaced by your toolbars ID.

Hope this helps,

Brother C
 
Hmmm hello Brother C,

Thanks for your answer, but it sounds, if this way is only for work with the MFC.
OK, I forgot to write, that I work with the Win32 API and not with the MFC, sorry. So I want to know, how it works in the Win32 API ?

Thank you again ...

SiM [sig][/sig]
 
Hi,

I've got the same problem. When I type : CToolBar m_wndToolBar; I've got errors,
because he doesn't know CToolBqr. So I tried it on an outher way, but I still haven't a
solution because there are still some errors and I don't know how to solve them.
This is what I wrote :

WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static PAINTSTRUCT ps;
static GLboolean left = GL_FALSE; /* left button currently down? */
static GLboolean right = GL_FALSE; /* right button currently down? */
TBBUTTON tb[2];
tb[0].iBitmap = 0;
tb[0].idCommand=IDM_STEP;
tb[0].fsState =TBSTATE_ENABLED;
tb[0].fsStyle = TBSTYLE_BUTTON;
tb[0].dwData = tb[0].iString = 0;
tb[1]= tb[0];
tb[1].iBitmap = 1;
tb[1].idCommand = IDM_BACK;
static HWND hwndTb;
static int id;
switch(uMsg) {
case WM_CREATE:
InitCommonControls();
hwndTb = CreateToolbarEx(hWnd,WS_CHILD|WS_VISIBLE|WS_BORDER,
0,1,hInstance,IDR_TOOLBAR1,tb,1,0,0,16,16,sizeof(TBBUTTON));
return 0;

Result :

th25test_11.obj : error LNK2001: unresolved external symbol __imp__CreateToolbarEx@52
th25test_11.obj : error LNK2001: unresolved external symbol __imp__InitCommonControls@0
Debug/t25.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

Do you know what is wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top