Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Set the CMiniDockFrame max and min track size info

Posted on 1997-03-07
1
Medium Priority
?
317 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 100 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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…
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.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

604 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