Азбука программирования в Win32 API


Азбука программирования в Win32 API - стр. 158


WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX,

CW USEDEFAULT, CW_USEDEFAULT, 400, 300, NULL, NULL, hfnstance,NULL); ifllhWnd) {

Message I.iox(NULL, "Cannot create window", "Error", MB_OK); return 0;

fnitC'oinmonControls(); /* Show our window */

ShowWmdow(hWnd,nCmdShow); UpdateWindow(hWnd);

189

/* Beginning of messages cycle */

while(GetMessage(&Msg, NULL, 0, 0))

{

TranslateMessage(&Msg); DispatchMessage(&Msg);

} return Msg.wParam;

LRESULT CALLBACK TabControIWndProc (HWND hWnd, UINT Message,

UINT wParam, LONG IParam )

{

HWND hTabControlWnd; RECT Rect; LPNMHDR IpNMHdr; LPTOOLTIPTEXT IpTooITipText; static HWND hDlg = 0; int nTab; TC_ITEM TCJtem;

switch(Message)

{

case WM_CREATE: GetClientRect(hWnd, &Rect);

hTabControlWnd = CreateWindow(WC_TABCONTROL, "", WS_ VISIBLE |

WS_TABSTOP | WS_CHILD | TCS_TOOLTIPS, 0, 0, Rect.right, Rect.bottom, hWnd, NULL, hlnst, NULL); TCJtem.mask = TCIFJTEXT; TC_Item.iImage = -1 ; TC_Item.pszText = "The first dialog"; TabCtrl_InsertItem(hTabControlWnd, 0, &TC_Item); TC_Item.pszText = "The second dialog"; TabCtrl_InsertItem(hTabControlWnd, 1, &TCJtem); TC_Item.pszText = "The third dialog"; TabCtrl_InsertItem(hTabControlWnd, 2, &TC_Item); hDlg = CreateDialog(hInst, "Dialog 1", hTabControlWnd, DialogProc); return 0;

case WMJMOTIFY: IpNMHdr = (LPNMHDR) IParam; switch(lpNMHdr->code) {

case TTN_NEEDTEXT: IpToolTipTcxt = (LPTOOLTIPTEXT) IParam; sprintf(lpToolTipText->lpszText, "Tip about tab No %d",

lpToolTipText->hdr.idFrom); break; caseTCN SELCHANGE:

190

if(hDlg)

Destroy Window(hDlg);

nTab = TabCtrl_GetCurSel( (HWND) lpNMHdr->hwndFrom); switch(nTab)

{

case 0:

hDlg = CreateDialog(hInst, "Dialog 1", hTabControlWnd, DialogProc); break; case 1:

hDlg = CreateDialog(hInst, "Dialog2", hTabControlWnd, DialogProc); break; case 2:

hDlg = CreateDialog(hInst, "Dialog3", hTabControlWnd, DialogProc); break; } break;




Начало  Назад  Вперед



Книжный магазин