Для использования обыкновенных табов, попробовал использовать пример приведенный на msdn'е:
| Код | HWND WINAPI CMyWin::SetMyTab(){
RECT rcClient; HWND hwndTab; TCITEM tie; int i;
// Get the dimensions of the parent window's client area, and // create a tab control child window of that size. GetClientRect(this->hWnd, &rcClient); LPINITCOMMONCONTROLSEX commonCtrls = NULL; ::InitCommonControlsEx(commonCtrls); try{ hwndTab = CreateWindow(WC_TABCONTROL, "GeneralTab", WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, 0, 0, rcClient.right, rcClient.bottom, this->hWnd, NULL, this->hInst, NULL); if(hwndTab==NULL){ throw Func_fail("Failure in CMyWin::SetMyTab, can't CreateWindow for hwndTab", ::GetLastError()); } }catch(...){ this->GetLastError(__FUNCTION__, __FILE__, __LINE__); } if (hwndTab == NULL) return NULL;
// Add tabs for each day of the week. char g_achTemp[]="Some text"; tie.mask = TCIF_TEXT | TCIF_IMAGE; tie.iImage = -1; tie.pszText = g_achTemp; for (i = 0; i < 7; i++) { LoadString(this->hInst, 1 + i, g_achTemp, sizeof(g_achTemp)/sizeof(g_achTemp[0])); if (TabCtrl_InsertItem(hwndTab, i, &tie) == -1) { DestroyWindow(hwndTab); return NULL; } } return hwndTab; } |
Как результат я получаю следующую ошибку линкера (при этом библиотека <commctrl.h> у меня вложена)
CMyWin.obj : error LNK2019: unresolved external symbol __imp__InitCommonControlsEx@4 referenced in function "public: struct HWND__ * __stdcall CMyWin::SetMyTab(void)"
Думаю ладно поробую использовать Property sheets. Затер строчку где вкладывалась библиотека <commctrl.h> и вложил как то и положено <prsht.h> И опять взял код в чистую с msdn'а:
| Код | void CMyWin::SetMyTab(){ PROPSHEETPAGE psp[2]; PROPSHEETHEADER psh; RECT rc; GetWindowRect(this->hWnd, &rc);
psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_USEICONID | PSH_PROPSHEETPAGE; psh.hwndParent = this->hWnd; psh.hInstance = this->hInst; psh.pszIcon =NULL; psh.pszCaption = (LPSTR) "Cell Properties"; psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nStartPage = 0; psh.ppsp = (LPCPROPSHEETPAGE) &psp; psh.pfnCallback = NULL; ::PropertySheet(&psh); return; } |
Линкер ругается, но уже по другому:
CMyWin.obj : error LNK2019: unresolved external symbol __imp__PropertySheetA@4 referenced in function "public: void __thiscall CMyWin::SetMyTab(void)"
Мне не понятно как же я мог так ошибиться, что получаю не разрешенный символ? |