Solved

Set the CMiniDockFrame max and min track size info

Posted on 1997-03-07
1
301 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mixString challenge 36 123
Shell script to login to remote m/c and execute commands 10 78
sumHeights2  challenge 7 107
Path of Workbook 3 79
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.

803 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