Search code examples
c++wtl

How to prevent WTL CSplitterWindow resize?


I am looking at MFC splitter window class override:

https://www.codeproject.com/Articles/6188/How-to-prevent-resizing-of-views-in-a-splitter-win

I had tested the override source code with WTL CSplitterWindow, but it doesn't worked.

i had modified the MainFrm.h using CSplitOverride instead of CSplitterWindow class.

when program start "api-ms-win-core-libraryloader-l1-2-0.dll missing.." popup error message shows.

windows 7 64bit os platform, 32 bit vs2015 build.

class CSplitOverride : public CSplitterWindow
{
public:
  CSplitOverride() { }

protected:
  BEGIN_MSG_MAP(CSplitOverride)
  MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest)
  END_MSG_MAP()

public:
  LRESULT OnNcHitTest(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
  {
    return HTNOWHERE;
  }
};

EDIT: i had been tried thickframe setting but no available. Jan S solution works like that i want.


Solution

  • Take a look at Michael Dunns excellent tutorial on splitter windows (this requires a few changes to get it to even compile in vs2013 though!)

    This discussion on the WTL sourceforge site also may be useful

    I think you are asking how you keep a pane a constant size when the main frame is resized? It depends on the alignment of the fixed pane

    atlsplit.h defines the following extended styles

    #define SPLIT_RIGHTALIGNED      0x00000004
    #define SPLIT_BOTTOMALIGNED     SPLIT_RIGHTALIGNED
    

    As Michael Dun says - "If none of those three styles are specified, the splitter defaults to being left- or top-aligned."

    • SPLIT_NONINTERACTIVE stops the user from resizing the pane
    • m_cxyMin hard codes the minimum size of the pane specified by the alignment

      m_wndHorzSplit.SetSplitterExtendedStyle(SPLIT_BOTTOMALIGNED | SPLIT_NONINTERACTIVE); m_wndHorzSplit.m_cxyMin = 150;