Algoritmo de velocidad de bolsillo
Devolución de llamada LRESULT WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(h instancia h instancia, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
Static TCHAR szAppNume[]= TEXT(" hola ganar ");
HWND hWnd
MSG MSG ;
WNDCLASS wndclass
clase wnd = CS _ HREDRAW | CS _ VREDRAW;
wndclass.lpfnWndProc = WndProc
wnd clase . cbclsextra = 0;
wnd clase . cbwndextra = 0;
wnd clase . h instancia = h instancia;
wndclass.hIcon = LoadIcon(NULL , IDI_Application);
clase wnd . hcursor = cargar cursor(NULL, IDC _ ARROW);
clase wnd = (HBRUSH)GetStockObject(WHITE _ BRUSH);
wndclass.lpszMenuName = NULL
clase wnd . nombre de clase lpsz = szAppNume;
if (!register class(&wndclass))
p >{
MessageBox(NULL, TEXT("¡Este programa requiere Windows NT!"), szAppNume, error MB_icon
Devuelve 0; >}
hWnd = CreateWindow(szAppNume, //Nombre de clase de ventana
TEXT("Hola programa"), //Título de ventana
WS_OVERLAPPEDWINDOW , // Estilo de ventana
CW_USEDEFAULT, //Posición x inicial
CW_USEDEFAULT, //Posición y inicial
CW_USEDEFAULT, //Tamaño x inicial
CW_USEDEFAULT, //Tamaño inicial y
NULL, //Identificador de la ventana principal
NULL, //Identificador del menú de la ventana
hInstance, //Identificador de la instancia del programa
NULL); //Parámetros de creación
ShowWindow(hWnd, icmd show);
Actualizar ventana (hWnd);
while (GetMessage(& msg, NULL, 0, 0))
{
Traducir mensaje(&msg);
mensaje de envío (amp; MSG);
}
Devuelve msg.wParam
}
Devolución de llamada LRESULT WndProc(HWND hWnd, mensaje UINT, WPARAM wParam, LPARAM lParam)
{
HDC hdc
PAINTSTRUCT ps
Rectángulo RECT;
interruptor (Mensaje)
{
Caso WM_CREATE:
Pausa;
Caso WM_PAINT:
hdc = comenzar pintura(hWnd &PS) ;
GetClientRect(hWnd &rect);
DrawText(hdc, Text("¡Hola, Windows 2000! "), -1, &rect,
DT_single line | DT_CENTER | DT_VCENTER);
Revestimiento final (hWnd & PS);
Devuelve 0;
Caso WM_DESTROY:
PostQuitMessage(0);
Devuelve 0;
}
Devuelve DefWindowProc(hWnd, mensaje , wParam, lParam);
}