WM_SIZE

Jun 13, 2011 at 3:24pm
Hi Guys,
I want to create WM_SIZE message.. But I failed in some situation otherwise my code works fine.. Can anybody help me to create WM_SIZE message.

I post sample below , how i create WM_SIZE message..

RECT wndRect;
::GetWindowRect( hwnd , &wndRect );
::PostMessage(hwnd, WM_SIZE , 0 , MAKELPARAM(wndRect.right-wndRect.left , wndRect.bottom-wndRect.top ));

Is this right way to create WM_SIZE message?

I m waiting for help..
Jun 13, 2011 at 3:28pm
closed account (z05DSL3A)
bally28 wrote:
I want to create WM_SIZE message.

Why do you want to do that?
Jun 13, 2011 at 3:38pm
If you want to simply change the size of the window use SetWindowPos()

http://msdn.microsoft.com/en-us/library/ms633545(v=VS.85).aspx
Jun 14, 2011 at 4:56am
Thanks Lamblion, but i know we can use SetWindowPos().. I want to know how to send WM_SIZE msg explicitely..
Jun 14, 2011 at 4:57am
Hi Grey Wolf,
I m doing one assignment.
Jun 14, 2011 at 7:49am
closed account (z05DSL3A)
bally28,

Sorry, my question was meant to be more along the lines of what is the reason you want your program to raise a WM_SIZE event?. I was going to suggest, as Lamblion, the SetWindowPos() API if it was simple changes to window size.

The method you posted doesn't look wrong (doesn't look like it would do anything though), so under what situations does it fail?
Jun 14, 2011 at 11:20am
I don't think this is your problem, but :
1
2
 width = right-left+1;
 height = bottom-top+1;
Jun 14, 2011 at 3:16pm
Do you want to resize the window? If you do, WM_SIZE doesn't work for this. In MSDN Online, you can read that WM_SIZE is "sent to a window after its size has changed". This means that WM_SIZE is just a notification and cannot and will not trigger a change in the window's size.
Jun 22, 2011 at 3:25am
yes that should work perfectly but i think what you want to do makes no sense as WM_SIZE notifies change in windows height or width, maximize,minimize...etc..
what i mean is that it's used for retrieving message about windows width,height..etc not for giving....
anyways, it would be better if you could say in what situation does this fail ????
Topic archived. No new replies allowed.