Nadir Van Thielen
asked on
C++ CreateWindow size action
I use : to create a new HWND
But requires the strike code for the window HWND chance his size
ex:
bool HWND (chance size)
{
x = windowX
y= windowY
}
But requires the strike code for the window HWND chance his size
ex:
bool HWND (chance size)
{
x = windowX
y= windowY
}
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
ASKER
Oky, i understand more now ,
but what i need is when i resize the from window that the text box change to the max format of the screen.
do i need to make a extra void or bool for it.
wand now is no control over it
but what i need is when i resize the from window that the text box change to the max format of the screen.
do i need to make a extra void or bool for it.
wand now is no control over it
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
...
...
hwndEdit = CreateWindowExW(WS_EX_CLIENTEDGE, TEXT("Edit"), NULL, WS_CHILD | ES_MULTILINE , 1, 1,800, 400, hWnd, (HMENU) NULL,NULL,NULL );
ShowWindow(hwndEdit, SW_SHOW);
Ok, so you want to re-size the edit-control in case it's parent window (i.e. a resizable dialog) is resized, right?
If so you have to implement a message handler for WM_SIZE in the parent window, whenever this message is passed to that message handler the passed parameters contain it's client-size which you can use to change the size of the edit control (with SetWindowPos as shown above) - you can find a simple example for such a WM_SIZE message handler i.e. at https://learnwinapi.wordpress.com/2012/01/08/lesson-5-window-message-basics/#packed_arguments.
ZOPPO
If so you have to implement a message handler for WM_SIZE in the parent window, whenever this message is passed to that message handler the passed parameters contain it's client-size which you can use to change the size of the edit control (with SetWindowPos as shown above) - you can find a simple example for such a WM_SIZE message handler i.e. at https://learnwinapi.wordpress.com/2012/01/08/lesson-5-window-message-basics/#packed_arguments.
ZOPPO
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
thank you.
you might consider of splitting points if more than one question helped. my comment actually was intended to be an addition to the solution already posted by ZOPPO.
Sara
you might consider of splitting points if more than one question helped. my comment actually was intended to be an addition to the solution already posted by ZOPPO.
Sara
Yes, Sara, generally I agree, but this time I think it's ok without splitting points, because I had the same thought the other way round at https://www.experts-exchange.com/questions/29044969/C-multi-line-text-box.html where you gave a lot of helpful extra information without recieving any points - so now it's balanced :o)
actually it is now 2:1 for me ;-) (i am a perfect counter)
Sara
Sara
:D
you have two possibilities:
1. Just pass wanted position and size of the created window as parameters 4 to 7 when calling CreateWindow
2. Use MoveWindow or SetWindowPos, i.e. just call this before the call to ShowWindow:
Open in new window
Hope this helps,ZOPPO