Handle EDIT-window position in WM_SIZE message
Example dialog with grip.#define WIN32_LEAN_AND_MEAN
#include <windows.h>
LRESULT CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
int __cdecl WinMainCRTStartup(void)
{
ExitProcess(DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(1001), NULL, (DLGPROC)MainDlgProc, 0));
}
LRESULT CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static HWND hGrip, hEdit;
switch (uMsg)
{
case WM_SIZE:
MoveWindow(hGrip, LOWORD(lParam)-20, HIWORD(lParam)-20, 20, 20, TRUE);
MoveWindow(hEdit, 4, 40, LOWORD(lParam)-8, HIWORD(lParam)-50, TRUE);
return TRUE;
case WM_INITDIALOG:
hGrip = GetDlgItem(hwndDlg, 4001);
hEdit = GetDlgItem(hwndDlg, 4002);
SetWindowPos(hwndDlg,0,0,0,250,200,SWP_NOMOVE);
return TRUE;
case WM_CLOSE:
EndDialog(hwndDlg, 0);
return TRUE;
}
return FALSE;
}
#include <windows.h>
LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US
1001 DIALOGEX DISCARDABLE 6, 18, 210, 146
STYLE DS_SHELLFONT|WS_POPUP|DS_MODALFRAME|DS_3DLOOK|DS_NOFAILCREATE|DS_CENTER|WS_THICKFRAME|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_VISIBLE
CAPTION "Dialog"
FONT 8, "Tahoma", 0, 0, 1
{
CONTROL "OK", IDOK, "Button", WS_TABSTOP, 4, 4, 45, 15
CONTROL "Cancel", IDCANCEL, "Button", WS_TABSTOP, 52, 4, 45, 15
CONTROL "", 4001, "ScrollBar", SBS_HORZ|0x00000014, 200, 132, 18, 18
CONTROL "Edit", 4002, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 4, 24, 204, 108
}