Código fuente Vc cs
# include & ltstdio.h & gt
Devolución de llamada LRESULT WinSunProc(HWND hwnd, //identificador de ventana
UINT uMsg , //Identificador del mensaje
WPARAM wParam, //Primer parámetro del mensaje
LPARAM lParam //Segundo parámetro del mensaje
); p>
int WINAPI WinMain(h instancia h instancia, //El identificador de la instancia actual
HINSTANCE hPrevInstance, //El identificador de la instancia anterior
LPSTR lpCmdLine, //Línea de comando
int nCmdShow //Mostrar estado
)
{
WNDCLASS wndcls
wnd cls cbclsextra = 0. ;
wnd cls . cbwndextra = 0;
wnd cls fondo =(HBRUSH)GetStockObject(BLACK _ BRUSH);
wndcls.hCursor =LoadCursor (NULL, IDC_CROSS);
wndcls.hIcon=LoadIcon(NULL, IDI_ERROR);
wndcls.h instancia = h instancia;
wndcls.lpfnWndProc = WinSunProc
wnd cls. lpsz nombre de clase = " weixin 2003 ";
wndcls.lpszMenuName = NULL
wnd estilo = CS _ HREDRAW | VREDRAW;
register class(& wnd cls);
HWND hwnd
Hwnd=CreateWindow("Weixin2003", "Centro de capacitación en ciencia y tecnología de la reforma de Beijing" , ws _ ventana superpuesta, 0, 0, 600, 400, nulo, nulo, hinstance, nulo);
ShowWindow (hwnd, SW _ muestra normal
Actualizar ventana ( hwnd);
MSG MSG;
while(GetMessage(& msg, NULL, 0, 0))
{
Traducir mensaje(&MSG);
mensaje de envío(&MSG);
}return 0;
}
Devolución de llamada LRESULT WinSunProc( HWND hwnd, //identificador de ventana
UINT uMsg, //identificador de mensaje
WPARAM wParam, //primer parámetro de mensaje
LPARAM lParam //El segundo parámetro de mensaje
)
{
Cambiar (uMsg)
{
Caso WM_CHAR: p>
char szChar[20];
sprintf(szChar, "Char es %d", wParam);
MessageBox(hwnd,szChar,"weixin",0 );
>
Pausa;
Caso WM_LBUTTONDOWN:
MessageBox(hwnd, "clic del mouse", "WeChat", 0
HDC hdc); p>
hdc = GetDC(hwnd);
TextOut(hdc, 0, 50, "Capacitación en lenguajes de programación informática", strlen("Capacitación en lenguajes de programación informática"));
ReleaseDC(hwnd,hdc);
Rotura;
Caso WM_PAINT:
HDC hDC
PAINTSTRUCT ps
hDC = comenzar pintura(hwnd & PS);
TextOut(hDC, 0, 0, "entrenamiento de reforma", strlen ("entrenamiento de reforma"); topcoat(hwnd&ps);
Rotura;
Caso WM_CLOSE:
If(IDYES==MessageBox(hwnd, "realmente cerrado" ", "weixin ", MB_YESNO))
{
destruir ventana(hwnd);
}
Romper;
case WM_DESTROY:PostQuitMessage(0);
Break;
Valor predeterminado:
Devuelve DefWindowProc(hwnd, uMsg, wParam, lParam
);}
Return 0;
}
El autor cree que escribí los parámetros incorrectos en createwindow, mi traducción compilada se ejecuta normalmente.