ShowWindow(myWnd,SW_SHOWNORMAL);
UpdateWindow(myWnd);
MSG msg;
BOOL f;
while(f=GetMessage(&msg,myWnd,0,0)!=0)
{
if(f==-1)
{
MessageBox(myWnd,"消息循环出错 GetMessage返回-1","asd",MB_OK);
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return 0;
}
int x=0,y=0;
LRESULT CALLBACK MyWinProc( HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_CHAR:
{HDC dc=GetDC(hwnd);
char s[2];
sprintf(s,"%c",wParam); //格式转换函数!! 记住了 徐家stdio。h
TextOut(dc,x,y,s,1);
x+=10;
if(400==x) {x=0;y+=20;}
ReleaseDC(hwnd,dc);
break;}