Link to home
Start Free TrialLog in
Avatar of cdesigner
cdesignerFlag for Russian Federation

asked on

CDialog + minimum size

Can I set minimum size of dialog window?

WM_GETMINMAXINFO not work
Avatar of captainkirk
captainkirk

Override CDialog::PreCreateWindow() and set the size of the dialog:

cs.cx = nTheWidthYouWant;
cs.cy = nTheHeightYouWant;
Avatar of cdesigner

ASKER

No!
If i resizedeialog with mouse? I need not start size, I need absolutly minimal size for window
WM_GETMINMAXINFO should work. Show your code please.
I didn't get
what do you mean by
>minimum size of dialog window?

You can resize a window
using :
(1) SetWindowPos with SWP_SIZE

(2) MoveWindow Call

Use these in OnInitDialog.
Hi There

Use of MinMaxInfo is workin for me.
This is how I have done it.

Use two variales nMinWidth & nMinHeight. Initialize them to 0 in the constructor.

In the oncreate of your dialog box set the values to nMinWidth
& nMinHeight
In OnCreate(........)
{
      if (CDialog::OnCreate(lpCreateStruct) == -1)
            return -1;
      m_minWidth  = lpCreateStruct->cx ;
      m_minHeight = lpCreateStruct->cy ;
}

in OnGetMinMaxInfo(......) function
{
if (!m_minWidth) // first time
{
   CDialog::OnGetMinMaxInfo(lpMMI);
   return;
}
    lpMMI->ptMinTrackSize.x = m_minWidth;
    lpMMI->ptMinTrackSize.y = m_minHeight;
}

This sets the minimum height & width below which you cannot resize
No work

OnGetMaxMinInfo - protected function in
CDialog and it not called anytime.

Once more:
I create Dialog window, And want to set
minimum size this windows - window can
resizing more but no less.
Can U clearly state the question.
What? sorry not understand
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No reply of my comments.

{
Hey bhat r u Rohit Bhat from SISL.
}
Oh , you right, CDialog not have this mesage in message map. you cool ! ;)
thanks
I am Vighnaraj Bhat