Home > Back-end >  Defines the 10 buttons and only show the a button and see cycle where there is a problem for me
Defines the 10 buttons and only show the a button and see cycle where there is a problem for me

Time:09-23

 

#include

Struct
{
Int iStyle;
TCHAR * szText;

}
The button []=
{
BS_PUSHBUTTON, TEXT (" PUSHBUTTON "),
DEFPUSHBUTTON BS_DEFPUSHBUTTON, TEXT (" "),
BS_CHECKBOX, TEXT (" CHECKBOX "),
AUTOCHECKBOX BS_AUTOCHECKBOX, TEXT (" "),
BS_RADIOBUTTON, TEXT (" RADIOBUTTON "),
BS_3STATE, TEXT (" three state "),
AUTO3STATE BS_AUTO3STATE, TEXT (" "),
GROUPBOX BS_GROUPBOX, TEXT (" "),
AUTORADIOBUTTON BS_AUTORADIOBUTTON, TEXT (" "),
BS_OWNERDRAW, TEXT (" OWNERDRAW ")



};
# define NUM (sizeof button/sizeof button [0])
LRESULT a CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
Int WINAPI WinMain (HINSTANCE HINSTANCE,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
Int nShowCmd)
{
The static TCHAR szAppName []=TEXT (" BTnLook ");
The HWND HWND;
MSG message;
WNDCLASS zf.
Zf. CbClsExtra=0;
Zf. CbWndExtra=0;
Zf. HbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH);
Zf. HCursor=LoadCursor (NULL, IDC_ARROW);
Zf. HIcon=LoadIcon (NULL, IDI_APPLICATION);
Zf. HInstance=hInstance;
Zf. LpfnWndProc=WndProc;
Zf. LpszClassName=szAppName;
Zf. LpszMenuName=NULL;
Zf. Style=CS_VREDRAW | CS_HREDRAW;



if (! RegisterClass (& amp; Zf))
{
MessageBox (NULL, TEXT (" my application "), szAppName, MB_ICONERROR);
return 0;
}
HWND=CreateWindow (szAppName, L "BTnLook WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
CW_USEDEFAULT CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
ShowWindow (HWND, SW_SHOW);
UpdateWindow (HWND);
While (GetMessage (& amp; The message, 0, 0))
{
TranslateMessage (& amp; Message);
DispatchMessage (& amp; Message);
}

The return message. WParam;
}
LRESULT a CALLBACK WndProc (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM)
{
The static HWND hwndButton (NUM);
The static the RECT the RECT.
The static TCHAR szTop []=TEXT (" the message wParam lParam "),
SzUnd []=TEXT ("......... "),
SzFormat []=TEXT (" % - 16 s % 4 x - 4 x - 4 x % % % 4 x "),
SzBuffer [50]=TEXT (" 50 ");
Static int cxChar, cyChar;
HDC HDC.
PAINTSTRUCT ps;
int i;

The switch (the message)
{
Case WM_CREATE message handler:
CxChar=LOWORD (GetDialogBaseUnits ());
CyChar=HIWORD (GetDialogBaseUnits ());
for (i=0; i{
HwndButton [I]=CreateWindow (TEXT (" button "), the button [I] szText,
WS_CHILD | WS_VISIBLE | button [I] iStyle, cxChar, cyChar * (1 + 2 * I),
20 * cxChar, 7 * cyChar/4, HWND, (HMENU), I (LPCREATESTRUCT lParam) - & gt; HInstance, NULL
);


return 0;

Case WM_SIZE:
The rect. Left=24 * cxChar;
The rect. Top=2 * cyChar;
The rect. Right=LOWORD (lParam);
The rect. Bottom=HIWORD (lParam);
return 0;

In case the WM_PAINT:

The InvalidateRect (HWND, & amp; The rect, TRUE);
HDC=BeginPaint (HWND, & amp; Ps);
SelectObject (HDC, GetStockObject ((SYSTEM_FIXED_FONT)));
SetBkMode (HDC, TRANSPARENT);

TextOut (HDC, 24 * cxChar, cyChar, szTop, lstrlen (szTop));
TextOut (HDC, 24 * cxChar, cyChar, szUnd, lstrlen (szUnd));

EndPaint (HWND, & amp; Ps);
return 0;

Case WM_DRAWITEM:

Case WM_COMMAND:
The ScrollWindow (HWND, 0, - cyChar, & amp; The rect, & amp; The rect);

HDC=GetDC (HWND);
SelectObject (HDC, GetStockObject (SYSTEM_FIXED_FONT));

TextOut (HDC, 24 * cxChar, cyChar * (the rect. The bottom/cyChar - 1),
SzBuffer,
Wsprintf (szBuffer szFormat,
Message==WM_DRAWITEM? The TEXT (" WM_DRAWITEM ") :
The TEXT (" WM_COMMAND "),
HIWORD (wParam), LOWORD (wParam),
HIWORD (lParam), LOWORD (lParam)));

ReleaseDC (HWND, HDC);
The ValidateRect (HWND, & amp; The rect);
break;

Case WM_DESTROY:
The PostQuitMessage (0);
Default:
break;
return 0;
}

Return DefWindowProc (HWND, message, wParam, lParam);
}






}

CodePudding user response:

Fold together?
  • Related