1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
//creating a tab control
HWND CreateTabControl(HWND hWnd, HINSTANCE hInstance, const unsigned int uID, const int iHeight, const int iWidth, const int iX, const int iY, const int iTab, ...)
{
TC_ITEM tc;
va_list va;
va_start(va, iTab);
if(hWnd != NULL && hInstance != NULL) {
HWND hTab = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TABCONTROL, NULL, WS_BORDER | WS_CHILD | WS_VISIBLE,
iX, iY, iWidth, iHeight, hWnd, reinterpret_cast<HMENU>(uID), hInstance, NULL);
if(hTab != NULL) {
ApplyFont(14, hTab);
for(int i = 0; i < iTab; i++) {
tc.mask = TCIF_TEXT;
tc.pszText = va_arg(va, LPSTR);
tc.iImage = -1;
tc.lParam = 0;
TabCtrl_InsertItem(hTab, i, &tc);
}
}
return hTab;
}
return NULL;
}
//creating a listview
HWND CreateListView(bool fCheckBoxes, const int iX, const int iY, const int iWidth, const int iHeight, HWND hWnd,
const unsigned int uId, HINSTANCE hInstance)
{
if (hWnd != NULL && hInstance != NULL)
{
HWND hListView = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, NULL,
WS_VISIBLE | WS_CHILD | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER,
iX, iY, iWidth, iHeight, hWnd, reinterpret_cast<HMENU>(uId), hInstance, NULL);
if (hListView != NULL)
{
ListView_SetExtendedListViewStyle(hListView, LVS_EX_GRIDLINES |
(fCheckBoxes ? LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT : LVS_EX_FULLROWSELECT));
ApplyFont(14, hListView);
}
return hListView;
}
return NULL;
}
//WM_CREATE handle
inline LRESULT HandleWM_CREATE(HWND hWnd)
{
CreateTabControl(hWnd, hInstance, IDC_TABCONTROL, 464, 637, 0, 0, 2, "A", "B");
//CreateListView(false, 0, 0, 637, 464, hWnd, IDC_LISTVIEW, hInstance);
return 0;
}
//WndProc CallBack
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
return HandleWM_CREATE(hWnd);
break;
case WM_COMMAND:
break;
case WM_CLOSE:
return (DestroyWindow(hWnd) == TRUE ? 0 : -1);
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
|