• 13
• 16
• 27
• 9
• 9

Child Windows - resizing problem

This topic is 4959 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I have created a child window ( edit box ) , after messin round with some code I got it working , but now it wont resize at all , I've put "MoveWindow" in "WM_SIZE" I assume I'm using the right function , but it seems to be doing nothing
        case WM_SIZE:
//resize status bar if the window is resized
SendMessage(g_hStatusBar, WM_SIZE, 0, 0);

GetClientRect(g_hStatusBar, &rStatus);
GetClientRect(hwnd, &rClientArea);

ClientWidth = rClientArea.right;
ClientHeight = rClientArea.bottom-rStatus.bottom;
MoveWindow(hChild, 0, 0, ClientWidth,  ClientHeight, TRUE);


I have previously declared RECT's for the main windows client area and the status bar , but I cant seem to get the edit box to resize , if I maximize the parent window the edit box stays the same , does anybody know what I mightt be causing this? here's the code I used to create the edit box
         HWND hChild;
RECT rClientArea;
RECT rStatus;

GetClientRect(hStatusBar, &rStatus);
GetClientRect(hwnd, &rClientArea);

int ClientHeight, ClientWidth;
ClientWidth = rClientArea.right;
ClientHeight = rClientArea.bottom-rStatus.bottom;

//create edit box
hChild = CreateWindowEx(
WS_EX_CLIENTEDGE,                   /* Extended possibilites for variation */
"EDIT",         /* Classname */
NULL,       /* Title Text */
WS_CHILD|WS_OVERLAPPED|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
ES_MULTILINE|ES_WANTRETURN,  /* default window */
CW_USEDEFAULT,       /* Windows decides the position */
CW_USEDEFAULT,       /* Windows decides the position */
ClientWidth,
ClientHeight,
hwnd,                // the window is a child window fo the main window
g_hInstance,       /* Program Instance handler */
NULL                 /* No Window Creation data */
);



Share on other sites
oh , I've also tried declaring new RECT's in WM_SIZE to work with , but they dont seem to work at all

Share on other sites
Looks ok to me. Is hChild inside WM_SIZE still valid?

You might also try to remove WS_OVERLAPPED from the edit's creation.