#include <commctrl.h>
#pragma comment(lib, "comctl32")
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_TABCTRL, szWindowClass, MAX_LOADSTRING);
// {
InitCommonControls();
// }
MyRegisterClass(hInstance);
...
}
...
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
// {
static HWND hTab;
static HWND hStatic;
static TCHAR *arNum[3]={"첫번째 페이지입니다. 탭 컨트롤로 페이지를 전환합니다.",
"여기는 두번째 페이지입니다.",
...};
// }
switch (message)
{
case WM_CREATE: {
TCITEM tie;
hTab=CreateWindow(WC_TABCONTROL,"",WS_CHILD | WS_VISIBLE
| WS_CLIPSIBLINGS,
0,0,0,0,hWnd,(HMENU)0,g_hInst,NULL);
tie.mask=TCIF_TEXT;
tie.pszText="one";
TabCtrl_InsertItem(hTab,0,&tie);
tie.pszText="two";
TabCtrl_InsertItem(hTab,1,&tie);
...
}
return 0;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case TCN_SELCHANGE:
...TabCtrl_GetCurSel(hTab)...
break;
}
return 0;
case WM_SIZE:
MoveWindow(hTab,0,0,LOWORD(lParam),HIWORD(lParam),TRUE);
...
return 0;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}