|
From: Vlada D. <dj...@im...> - 2002-12-03 09:40:45
|
Hi.
I'm trying a toolbar for my window, but I keep geting a lot of "undeclared"
error messages. I included commctrl.h in my source and added -lcomctl32 in
linker options, but it doesn't work. Here's compiler output (part of it):
23 C:\Visual\Interface\main.cpp
`INITCOMMONCONTROLSEX' undeclared (first use this function)
24 C:\Visual\Interface\main.cpp
`ccx' undeclared (first use this function)
26 C:\Visual\Interface\main.cpp
implicit declaration of function `int InitCommonControlsEx(...)'
92 C:\Visual\Interface\main.cpp
`BTNS_BUTTON' undeclared (first use this function)
95 C:\Visual\Interface\main.cpp
`CX_SEPARATOR' undeclared (first use this function)
95 C:\Visual\Interface\main.cpp
`BTNS_SEP' undeclared (first use this function)
.... and so on.
This is piece of code I used to create toolbar:
int WINAPI
WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved
*/
WNDCLASSEX wincl; /* Data structure for the windowclass */
INITCOMMONCONTROLSEX ccx;
ccx.dwSize=sizeof(INITCOMMONCONTROLSEX);
ccx.dwICC=ICC_BAR_CLASSES;
InitCommonControlsEx(&ccx);
..............
case WM_CREATE:
{
TBBUTTON tbButtons[]=
{ {STD_FILENEW,ID_FILE_NEW,TBSTATE_ENABLED,BTNS_BUTTON,0L,0},
{STD_FILEOPEN,ID_FILE_OPEN,TBSTATE_ENABLED,BTNS_BUTTON,0L,0},
{STD_FILESAVE,ID_FILE_SAVE,TBSTATE_ENABLED,BTNS_BUTTON,0L,0},
{CX_SEPARATOR,0,TBSTATE_ENABLED,BTNS_SEP,{0,0},0,-1},
{STD_CUT,ID_EDIT_CUT,TBSTATE_ENABLED,BTNS_BUTTON,0L,0},
{STD_COPY,ID_EDIT_COPY,TBSTATE_ENABLED,BTNS_BUTTON,0L,0}
{STD_PASTE,ID_EDIT_PASTE,TBSTATE_ENABLED,BTNS_BUTTON,0L,0}
};
HWND
hToolBar=CreateToolbarEx(hwnd,WS_CHILD|WS_BORDER|WS_VISIBLE|TBSTYLE_TOOLTIPS
,
IDT_TOOLBAR,15,HINST_COMMCTRL,IDB_STD_SMALL_COLOR,tbButtons,ARRAYSIZE(tbButt
ons),
0,0,100,300,sizeof(TBBUTTON));
if(!hToolBar)
MessageBox(hwnd,"Can't create toolbar!","eror",MB_OK);
}
break;
Help, please!!
Regards,
Vlada
|