case WM_CREATE: 

/* The window is being created. Create our button 
* window now. */ 
TEXTMETRIC tm; /* First we use the system fixed font size to choose 
* a nice button size. */ 
hdc = GetDC (hwnd); 
SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT)); 
GetTextMetrics (hdc, &tm); 
cx = tm.tmAveCharWidth * 30; 
cy = (tm.tmHeight + tm.tmExternalLeading) * 2; 
ReleaseDC (hwnd, hdc); /* Now create the button */ 
hwndButton = CreateWindow ( 
"button",/* Builtin button class */ 
"Click Here", 
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
0, 0, cx, cy, 
hwnd,/* Parent is this window. */ 
(HMENU) 1,/* Control ID: 1 */ 
((LPCREATESTRUCT) lParam)->hInstance, 
NULL); /*创建一个编辑框 */ 
hwndEdit = CreateWindow(TEXT("Edit"), 
NULL, 
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT, 
0,0,100,20, 
hwnd, 
(HMENU)ID_EDIT, 
((LPCREATESTRUCT)lParam)->hInstance, 
NULL); //PlaySound (TEXT ("hellowin.wav"), NULL, SND_FILENAME | SND_ASYNC) ; 
break; return 0; 
break; 
} case WM_COMMAND: 

/* Check the control ID, notification code and 
* control handle to see if this is a button click 
* message from our child button. */ 
if (LOWORD(wParam) == 1 && 
    HIWORD(wParam) == BN_CLICKED && 
    (HWND) lParam == hwndButton) 

char *pBuf = "Connecting..."; /* 取出来编辑框里面的内容 */ CHAR  strText[1024]= " "; 
GetWindowText(hwndEdit, strText, 100); MessageBox(NULL, strText, "文本框里的内容是: ",0);//每次获取都是空 
//memcpy(g_Databuf, pBuf, strlen(pBuf)); 
InvalidateRect(hwnd,NULL,TRUE); 
UpdateWindow(hwnd); 

return 0; 
break; 
}