Solved

Set the CMiniDockFrame max and min track size info

Posted on 1997-03-07
1
306 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

749 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