Solved

Set the CMiniDockFrame max and min track size info

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

22 Experts available now in Live!

Get 1:1 Help Now