为什么我的程序显示不出来(编译器没有报错)
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include<stdio.h>
LRESULT CALLBACK WinSunProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
BOOL InitWindowsClass(HINSTANCE hintance);
BOOL InitWindows(HINSTANCE hInstance,int nCmdShow);
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
LRESULT CALLBACK WinSunProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
HDC hdc;
POINT points[6]={{50,235},{70,250},{70,270},{30,270},{30,250},{50,235}};
PAINTSTRUCT ps;
HPEN hpen;
HBRUSH hbrush;
switch(uMsg)
{ case WM_PAINT:
hdc=BeginPaint(hwnd, &ps);
hpen=(HPEN)GetStockObject(NULL_PEN);
SelectObject(hdc,hpen);
hbrush=(HBRUSH)GetStockObject(BLACK_BRUSH);
SelectObject(hdc,hbrush);
LineTo(hdc,50,50);
hpen=CreatePen(PS_SOLID,10,RGB(255,0,255));
SelectObject(hdc,hpen);
LineTo(hdc,250,50);
LineTo(hdc,150,100);
LineTo(hdc,50,50);
Polyline(hdc,points,6);
Arc(hdc,170,50,220,100,180,100,180,100);
DeleteObject(hpen);
DeleteObject(hbrush);
EndPaint(hwnd,&ps);
case WM_DESTROY:
PostQuitMessage(0);
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
}
BOOL InitWindows(HINSTANCE hInstance,int nCmdShow)
{
HWND hwnd;
hwnd=CreateWindow("畜生","禽兽",WS_OVERLAPPEDWINDOW,0,0,600,400,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
return TRUE;
}
BOOL InitWindowClass(HINSTANCE hInstance)
{
WNDCLASS wndclass1;
wndclass1.cbClsExtra=0;
wndclass1.cbWndExtra=0;
wndclass1.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass1.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass1.hIcon=LoadIcon(NULL,IDI_ERROR);
wndclass1.hInstance=hInstance;
wndclass1.lpfnWndProc=WinSunProc;
wndclass1.lpszClassName="畜生";
wndclass1.lpszMenuName=NULL;
wndclass1.style=CS_HREDRAW|CS_VREDRAW;
return RegisterClass(&wndclass1);
}