vc++的问题啊

来源:百度知道 编辑:UC知道 时间:2024/05/18 01:35:08
输入单击后弹出窗口输出 一闪而过·看不到结果、
哪错了或者怎么写

#include<windows.h>
#include<math.h>
#include<stdio.h>
char str[80];
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
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 =(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName =NULL;
wndclass.lpszClassName ="HelloWin";
if(!RegisterClass(&wndclass))
{
MessageBox(NULL,"窗口注册失败!","HelloWin",0);
return 0;
}
hwnd=

把回调函数这样写,你再看看
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
// HDC hdc;
// PAINTSTRUCT ps;
static HWND hwndButton,hwndEdit;
char strEdit[80];
switch(message)
{
case WM_CREATE:
hwndEdit=CreateWindow("edit",NULL,WS_CHILD|WS_VISIBLE|WS_BORDER,10,60,100,25,hwnd,NULL,NULL,NULL);
hwndButton=CreateWindow("button","Show",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,340,60,80,25,hwnd,NULL,NULL,NULL);
break;
case WM_COMMAND:
if(((HWND)lParam==hwndButton)&&(HIWORD(wParam)==BN_CLICKED))
{GetWindowText(hwndEdit,strEdit,80);
}strcpy(str,strEdit);
InvalidateRect(hwnd,NULL,FALSE);
break;
case WM_PAINT:
//MessageBox(NULL,str,"Show",0);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,message,wParam,lParam);
}
re