문제

hWndEdit = CreateWindow(TEXT("edit"),
            NULL, WS_CHILD | WS_VISIBLE | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | WS_BORDER,
            pt.x, pt.y, 100, 50, hWnd, (HMENU)ID_EDIT, hInst, NULL);

RECT* rect_temp;

rect_temp = new RECT();

SendMessage(hWndEdit, EM_GETRECT, 0, (LPARAM)rect_temp);

PS:the problem is what I get is always (2,2,34,98).

도움이 되었습니까?

해결책

from MSDN for EM_GETRECT:

Gets the formatting rectangle of an edit control. The formatting rectangle is the limiting rectangle into which the control draws the text. The limiting rectangle is independent of the size of the edit-control window. You can send this message to either an edit control or a rich edit control.

the part:

The limiting rectangle is independent of the size of the edit-control window.

CreateWindow creates whole control not what inside it, to modify inside formatting of EDIT use EM_SETRECT .

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top