austin
2005-11-28 05:39:23 UTC
Hi all,
I am facing a problem in using SetWindowPos() . I am handling a
localization project. For this i need to resize and reposition the
dialog controls. I am calling GetWindowRect () to get the control
dimensions and after changing them i am trying to call SetWindowPos()
to place the control to the changed position.
The following is the code i am using ..
RECT gControlDimension;
HWND hCtrl;
//Handle to the Dialog control
hCtrl = GetDlgItem (hWnd, ID_CURRENT);
//Get the control dimensions
status1 = GetWindowRect (hCtrl, &gControlDimension);
ctrlLeft = gControlDimension.left ;
ctrlRight = gControlDimension.right;
ctrlTop = gControlDimension.top;
ctrlBottom = gControlDimension.bottom;
ctrlWidth = ctrlRight - ctrlLeft;
ctrlHeight = ctrlBottom - ctrlTop;
/*
//Here i am using the logic to change
ctrlLeft,ctrlRight,ctrlWidth,ctrlHeight.
//I am not adding that here as it is coming to around 20 lines.
*/
if (onlyresize)
{
SetWindowPos ( hCtrl,NULL, ctrlLeft, ctrlTop, ctrlWidth, ctrlHeight,
SWP_NOMOVE );
}
else//both resize and move
{
SetWindowPos ( hCtrl,NULL, ctrlLeft, ctrlTop, ctrlWidth,
ctrlHeight, SWP_NOZORDER);
}
This last check is failing for me. if onlyresize means the window is
getting resized properly and showing me the output window which is a
resized one properly.
But if it needs to move ie in the else part the window is not
showing.Why so?? I tried with all the flags, other than SWP_NOMOVE none
of the other flags are showing me the window at all.I added showwindow
after Setwindowpos in else part but still the result remains same.
If I have to use MoveWindow() how can i use it better??
pls let me know where it is going wrong.
Thanks in advance
suresh.
I am facing a problem in using SetWindowPos() . I am handling a
localization project. For this i need to resize and reposition the
dialog controls. I am calling GetWindowRect () to get the control
dimensions and after changing them i am trying to call SetWindowPos()
to place the control to the changed position.
The following is the code i am using ..
RECT gControlDimension;
HWND hCtrl;
//Handle to the Dialog control
hCtrl = GetDlgItem (hWnd, ID_CURRENT);
//Get the control dimensions
status1 = GetWindowRect (hCtrl, &gControlDimension);
ctrlLeft = gControlDimension.left ;
ctrlRight = gControlDimension.right;
ctrlTop = gControlDimension.top;
ctrlBottom = gControlDimension.bottom;
ctrlWidth = ctrlRight - ctrlLeft;
ctrlHeight = ctrlBottom - ctrlTop;
/*
//Here i am using the logic to change
ctrlLeft,ctrlRight,ctrlWidth,ctrlHeight.
//I am not adding that here as it is coming to around 20 lines.
*/
if (onlyresize)
{
SetWindowPos ( hCtrl,NULL, ctrlLeft, ctrlTop, ctrlWidth, ctrlHeight,
SWP_NOMOVE );
}
else//both resize and move
{
SetWindowPos ( hCtrl,NULL, ctrlLeft, ctrlTop, ctrlWidth,
ctrlHeight, SWP_NOZORDER);
}
This last check is failing for me. if onlyresize means the window is
getting resized properly and showing me the output window which is a
resized one properly.
But if it needs to move ie in the else part the window is not
showing.Why so?? I tried with all the flags, other than SWP_NOMOVE none
of the other flags are showing me the window at all.I added showwindow
after Setwindowpos in else part but still the result remains same.
If I have to use MoveWindow() how can i use it better??
pls let me know where it is going wrong.
Thanks in advance
suresh.