views:

117

answers:

2

Hi everybody!

When a window handle is given, how can i exactly resize a window sending windows messages towards it? I've tried many things such as sendig a WM_SIZING Message to the window, but nothing worked(the way i did it).

I don't like to use SetWindowPosition.

Thanks in advance,

David

+8  A: 

WM_SIZE and WM_SIZING are not commands, they are notifications sent by SetWindowPlacement. You can use that or any of the conveniece API available, including SetWindowPos and MoveWindow.

avakar
A: 

I try:

in .h:

#define WM_RESIZEMESSAGE        (WM_USER+1)
void ResizeHandler (WPARAM wParam, LPARAM lParam);

in .cpp:

ON_MESSAGE (WM_RESIZEMESSAGE, ResizeHandler )

void CTestClass::ResizeHandler (WPARAM wParam, LPARAM lParam)
{
  int x = 100; //--> desired size
  int y = 100; //-->desired size
  MoveWindow(0, 0, x, y, TRUE); //->Move window

}

The above code may not be as you want, because I'm not clear which window you would like to resize, and calling the resize from another class or what...

I just suggest to use MoveWindow() if you don't like to use SetWindowPos().

wengseng