请问如何从一个EDIT控件中得到数据然后显示出来?
int m;
HWND input,button;
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
int Length;
char buffer[100];
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
static int cyClient,cxClient, cxChar,cyChar;
switch(message)
{
case WM_CREATE:
cxClient=GetSystemMetrics(SM_CXFULLSCREEN);
cyClient=GetSystemMetrics(SM_CYFULLSCREEN);
input =CreateWindow("EDIT",NULL,WS_CHILD|WS_VISIBLE|ES_LEFT|WS_BORDER,
cxClient/100,cyClient/100,100,30,hwnd,(HMENU)1,hInst,NULL);
button=CreateWindow("BUTTON",NULL,WS_CHILD|WS_VISIBLE|ES_LEFT|WS_BORDER,
cxClient/100,cyClient/100+60,100,30,hwnd,(HMENU)2,hInst,NULL);
return 0;
case WM_COMMAND:
switch(wParam)
{
case 2:
Length=GetWindowTextLength(input)+1;
GetWindowText(input,buffer,Length);
m=strtol(buffer,NULL,Length);
InvalidateRect(hwnd,NULL,TRUE);
}
return 0;
case WM_PAINT:
hdc=BeginPaint(hwnd,&ps);
TextOut(hdc,200,100,buffer,sprintf(buffer,"%d",m));
EndPaint(hwnd,&ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd,message,wParam,lParam);
}
这么写为什么无法得到数据呢?