Criar um componente BS_AUTOCHECKBOX

#include <windows.h>
#include <wingdi.h> /**Window Graphic Device Interface*/
#include <math.h>
#include <gdiplus.h> /** Graphic Device Interface Plus */
#include <winerror.h>
#define NUM 1000
#define TWOPI (2 * 3.14159)
/** Charles Petzold, 1998 */
#define MoveToEx
#define LineTo
#define Polyline
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); /**Propótipo*/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) {
static TCHAR szAppName[] = TEXT("SineWave");
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = GetSysColorBrush(COLOR_INFOBK);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
if(!RegisterClass(&wndclass)) {
MessageBox(NULL, TEXT("Windows NT Standard"), szAppName, MB_ICONERROR);
return 0;
}
hwnd = CreateWindow(szAppName, TEXT("BS_AUTOCHECKBOX"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 500, 300, NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, iCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
switch(message) {
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_CREATE:
CreateWindow(
TEXT("button"), TEXT("CHECKBOX 1"), WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
10, 40, 140, 20,
hwnd, NULL, NULL, NULL
);
CreateWindow(
TEXT("button"), TEXT("CHECKBOX 2"), WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
200, 40, 140, 20,
hwnd, NULL, NULL, NULL
);
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
Comentários
Postar um comentário