при линке с CreateToolbarEx ошибка !
вот хочу кнопку добавиь с помощью функции CreateToolbarEx :
BOOL OnCreate(HWND hwnd,LPCREATESTRUCT *FAR)
{ hPen=CreatePen(PS_SOLID,8,RGB(255,0,120));
hBrush=CreateSolidBrush(RGB(0,128,128)) ;
/**/
TBBUTTON tbb;
ZeroMemory(&tbb,sizeof(tbb));
tbb.iBitmap=1;
tbb.fsState=TBSTATE_ENABLED;
tbb.idCommand=ID_1;
CreateToolbarEx(hwnd,WS_CHILD|WS_VISIBLE,
-1,1,hI,ID_TB1,&tbb,1,32,32,32,32,sizeof(TBBUTTON));
/**/
return TRUE;
в ресурсе прописал ID_TB1 BITMAP "tbb1.bmp"
в хедере - #define ID_TB1 400
копилируется без ошибок
а линк выдает
Linking...
EditGraph.obj : error LNK2019: unresolved external symbol "int __cdecl OnCreate(struct HWND__ *,struct tagCREATESTRUCTA *)" (?OnCreate@@YAHPAUHWND__@@PAUtagCREATESTRUCTA@@@Z) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
EditGraph.obj : error LNK2019: unresolved external symbol __imp__CreateToolbarEx@52 referenced in function "int __cdecl OnCreate(struct HWND__ *,struct tagCREATESTRUCTA * *)" (?OnCreate@@YAHPAUHWND__@@PAPAUtagCREATESTRUCTA@@@Z)
D:\VSС++\examples\GraphED\Debug\GraphED.exe : fatal error LNK1120: 2 unresolved externals
Build log was saved at "file://d:\VSС++\examples\GraphED\GraphED\Debug\BuildLog.htm"
GraphED - 3 error(s), 0 warning(s)
кто может помогите !!! :confused:
все делал по книге
без CreateToolbarEx все работает...
а как это сделать?))
спасибо тебе за совет!!! )))
я уже разобрался спасиб0 )
все тот же MSDN
[highlight=cpp]
// CreateAToolBar creates a toolbar and adds a set of buttons to it.
// The function returns the handle to the toolbar if successful,
// or NULL otherwise.
// hwndParent is the handle to the toolbar's parent window.
HWND CreateAToolBar(HWND hwndParent)
{
HWND hwndTB;
TBADDBITMAP tbab;
TBBUTTON tbb[3];
char szBuf[16];
int iCut, iCopy, iPaste;
INITCOMMONCONTROLSEX icex;
HRESULT hr;
size_t cch;
// Ensure that the common control DLL is loaded.
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_BAR_CLASSES;
InitCommonControlsEx(&icex);
// Create a toolbar.
hwndTB = CreateWindowEx(0, TOOLBARCLASSNAME, (LPSTR) NULL,
WS_CHILD | 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 button strings to the toolbar's internal string list.
LoadString(g_hinst, IDS_CUT, szBuf, MAX_LEN-1);
//Save room for second terminating null character.
hr = StringCchLength(szBuf, MAX_LEN, &cch);
if(SUCCEEDED(hr))
{
szBuf[cch + 2] = 0; //Double-null terminate.
}
else
{
// TODO: Write error handler.
}
iCut = SendMessage(hwndTB, TB_ADDSTRING, 0, (LPARAM) (LPSTR) szBuf);
LoadString(g_hinst, IDS_COPY, szBuf, MAX_LEN-1);
//Save room for second terminating null character.
hr = StringCchLength(szBuf, MAX_LEN, &cch);
if(SUCCEEDED(hr))
{
szBuf[cch + 2] = 0; //Double-null terminate.
}
else
{
// TODO: Write error handler.
}
iCopy = SendMessage(hwndTB, TB_ADDSTRING, (WPARAM) 0,
(LPARAM) (LPSTR) szBuf);
LoadString(g_hinst, IDS_PASTE, szBuf, MAX_LEN-1);
//Save room for second terminating null character.
hr = StringCchLength(szBuf, MAX_LEN, &cch);
if(SUCCEEDED(hr))
{
szBuf[cch + 2] = 0; //Double-null terminate.
}
else
{
// TODO: Write error handler.
}
iPaste = SendMessage(hwndTB, TB_ADDSTRING, (WPARAM) 0,
(LPARAM) (LPSTR) szBuf);
// Fill the TBBUTTON array with button information, and add the
// buttons to the toolbar. The buttons on this toolbar have text
// but do not have bitmap images.
tbb[0].iBitmap = I_IMAGENONE;
tbb[0].idCommand = IDS_CUT;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = BTNS_BUTTON;
tbb[0].dwData = 0;
tbb[0].iString = iCut;
tbb[1].iBitmap = I_IMAGENONE;
tbb[1].idCommand = IDS_COPY;
tbb[1].fsState = TBSTATE_ENABLED;
tbb[1].fsStyle = BTNS_BUTTON;
tbb[1].dwData = 0;
tbb[1].iString = iCopy;
tbb[2].iBitmap = I_IMAGENONE;
tbb[2].idCommand = IDS_PASTE;
tbb[2].fsState = TBSTATE_ENABLED;
tbb[2].fsStyle = BTNS_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;
}
[/highlight]
все что & # 91; это форум заменил так [