我正在尝试从我在运行时创建的编辑控件中获取文本,并将其中的文本打印到我也在运行时创建的父窗口(而不是标题栏)上。我该怎么做呢?
const int bufferSize = 1024;
char textBuffer[bufferSize] = "";
HWND Editbox = FindWindowEx(hWnd, NULL, "Edit", NULL);
SendMessage(Editbox, WM_GETTEXT,
(WPARAM)bufferSize, (LPARAM)textBuffer);
HWND Picbox = FindWindowEx(hWnd, NULL, "Picbox", NULL);
RECT Picbox_Rect;
GetClientRect(Picbox,&Picbox_Rect);
Picbox_Rect.top = 3;
Picbox_Rect.left = 3;
hdc = GetDC (Picbox) ;
HFONT fnt = CreateFont(14,0,0,0,FW_DONTCARE,
FALSE,FALSE,FALSE,DEFAULT_CHARSET,
OUT_OUTLINE_PRECIS,CLIP_DEFAULT_PRECIS,
0, VARIABLE_PITCH,TEXT("Verdana"));
SelectObject(hdc, fnt);
SetTextColor(hdc,RGB(0,0,255));
SetBkMode(hdc, TRANSPARENT);
DrawText(hdc, textBuffer, strlen (textBuffer),
&Picbox_Rect, DT_LEFT);
ReleaseDC (Picbox, hdc) ;
DeleteObject(fnt);
//InvalidateRect(Picbox, NULL, TRUE);