Solved

Set the CMiniDockFrame max and min track size info

Posted on 1997-03-07
1
297 Views
Last Modified: 2013-11-20
Hello,

I am trying to set the min and max tracking size for WM_GETMINMAXINFO when my dialog bar, which is derived from CDialogBar, is floating.  I tried subclassing to the CMiniDockFrameWnd to respond to the WM_GETMINMAXINFO but still does not work. CMiniDockFrameWnd is created automatically by Microsoft  when the dialog bar is floated inside the MFC source code BARDOCK.CPP.  When I ran my code, I do get the messages in the CMiniDockFrameWnd procedure that I have subclassed.  Can anyone help me?  Below is part of my code:
void CNewSldClass::StartFloating()
{
      //need to get the CMiniDockFrameWnd
      CWnd* pFrame = GetDockingFrame();
      m_OldMiniFrameProc = (WNDPROC)GetWindowLong(pFrame -> m_hWnd, GWL_WNDPROC);
      SetWindowLong(pFrame -> m_hWnd,GWL_USERDATA,(LONG)this);
      WNDPROC NewMiniFrameProc = (WNDPROC)CNewSldClass::SubclassMiniFrameProc;
      SetWindowLong (pFrame -> m_hWnd,GWL_WNDPROC,(LONG)NewMiniFrameProc);
}
LRESULT CALLBACK CNewSldClass::SubclassMiniFrameProc(HWND hWnd,UINT nMessage,WPARAM wParam,LPARAM lParam)
{
      CNewSldClass* pSldDlgBar = (CNewSldClass*)GetWindowLong(hWnd, GWL_USERDATA);
 
      switch (nMessage)
      {
            case WM_DESTROY:
                  MessageBeep(0);
            break;

            case WM_GETMINMAXINFO:
            {
                  MINMAXINFO FAR* lpMMI = (MINMAXINFO FAR*)lParam;
                  RECT rect = {0,0,80,70};
                  CWnd* pFrame = FromHandle(hWnd);
                  pFrame -> CalcWindowRect(&rect,0);
                  int iWd = rect.right - rect.left;
                  int iHt = rect.bottom - rect.top;
                lpMMI -> ptMinTrackSize.x = iWd;
                lpMMI -> ptMinTrackSize.y = iHt;
                  return 0L;
            }
            break;

            default:
                  return (CallWindowProc((pSldDlgBar -> m_OldMiniFrameProc), hWnd, nMessage, wParam, lParam));
            break;
      }
      return 0L;
}//endof SubclassMiniFrameProc
0
Comment
Question by:jli
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1300222
When you subclass your CMiniDockFrame, you don't need to write so many codes. Instead, you can just override CMiniDockFrame::OnGetMinMaxInfo().

ON_WM_GETMINMAXINFO()

afx_msg void CMiniDockFrame::OnGetMinMaxInfo(MINMAXINFO FAR *lpMMI)
{
    if (bFloating)
    {
        RECT rect = {0,0,80,70};
        this->CalcWindowRect(&rect,0);
        int iWd = rect.right - rect.left;
        int iHt = rect.bottom - rect.top;
        lpMMI -> ptMinTrackSize.x = iWd;
        lpMMI -> ptMinTrackSize.y = iHt;
    }
}

This should work.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now