Sample Image - WTLDockingWindows1.png


This is an implementation of docking windows for the WTL library. The following topics describe how to use docking window classes.

Pre-Build Set-Up.
  • Make sure all header files are placed in the appropriate location and compiler can reach it.
  • Add DockImpl.cpp to the project. Probably the best way to do it is to add #include<span class="code-keyword"><DockImpl.cpp></span> to the stdafx.cpp.
  • Docking Windows use STL so it’s requires to enable exception handling (/GX or /EH compiler options) and remove _ATL_MIN_CRT from the list the preprocessor defines in release configuration. If you use standard HP’s STL you can leave default project setting intact, but I don’t think it is a good idea.
  • If you use boost library define USE_BOOST.
  • I use some private message in range WM_USER to WM_USER + 2

    So if you define your own private messages please use WMDF_LAST+1 or if it is impossible redefine WMDF_FIRST.

Add to Main Frame Support for Docking Window Features
  • Create a new project with ATL/WTL AppWizard (MDI or SDI as you like)
  • Add #include <span class="code-keyword"><DockingFrame.h></span> to CMainFrame header.
  • Change the base of your CMainFrame class to dockwins::CDockingFrameImpl<CMainFrame> for SDI applications or to dockwins::CMDIDockingFrameImpl<CMainFrame> for MDI applications. All references to previous base class should be replaced by new one.
  • Add to the OnCreate method of your CMainFrame class InitializeDockingFrame(); it’s the best place to change windows behavior of docking window. By default it is depend on system setting (Show window contents while dragging) if you for some reason need to change it you should use the following flags:
    CDockingBarStyle::sUseSysSettings — depend on system setting, default.
    CDockingBarStyle::sIgnoreSysSettings | CDockingBarStyle::sFullDrag — full drag
    CDockingBarStyle::sIgnoreSysSettings | CDockingBarStyle::sGhostDrag — ghost drag.
    If you use auto-hiding features you also can use the following flags:
    CDockingBarStyle::sAnimation — animate auto-hiding windows.
    CDockingBarStyle::sNoAnimation — do not animate auto-hiding windows.
Implement a Docking Window
  • Add #include <span class="code-keyword"><ExtDockingWindow.h></span> to header file of your docking window.
  • Create new class CSampleDockingWindow for example. Derive it from dockwins::CTitleDockingWindowImpl.
  • Add message map and DECLARE_WND_CLASS macro The CSampleDockingWindow class should look like this:Hide Copy Code
    class CSampleDockingWindow :
             public dockwins::CTitleDockingWindowImpl< SampleDockingWindow,
                    CWindow, dockwins::COutlookLikeTitleDockingWindowTraits >
            typedef CSampleDockingWindow    thisClass;
            typedef dockwins::CTitleDockingWindowImpl<CSAMPLEDOCKINGWINDOW,
             dockwins::COutlookLikeTitleDockingWindowTraits>  baseClass;
  • Instantiate an object of the CSampleDockingWindow class as a member of the CMainFrame
  • In the CMainFrame::OnCreate(...) method, call the Create(...) method of the instantiated docking window class.Hide Copy Code
    LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/,
                     BOOL& /*bHandled*/)
            CRect rcBar(0,0,100,100);
            m_sampleDockWnd.Create(m_hWnd,rcBar,_T("Sample docking window"));

    Do not use empty rect even if you dock the window. When window start dragging it use previously stored floating rect size.

Add to Generic Window Support for Docking Window Features

To implement a window with docking window features, derive a class from dockwins::CDockingSiteImpl. In derived class chain default message map to the base class.
Hide Copy Code

class CDockSiteSampleWnd : public dockwins::CDockingSiteImpl <
        CDockSiteSampleWnd >
        typedef dockwins::CDockingSiteImpl < CDockSiteSampleWnd > baseClass;
Add Support for Tabbed Docking Window
  • The tabbed docking window depend on Daniel Bowen’s The Codeproject article “Custom Tab Controls,Tabbed Frame and Tabbed MDI”, Please download the source code for this article.
  • Change the base class of your docking window from dockwins::CTitleDockingWindowImpl to dockwins::CBoxedDockingWindowImpl.
  • Use the following classes as traits for the dockwins::CBoxedDockingWindowImpl: COutlookLikeBoxedDockingWindowTraits, COutlookLikeExBoxedDockingWindowTraits or CVC6LikeBoxedDockingWindowTraits.
  • To add tabbed docking features support to the previous CSampleDockingWindow class, the code should look like this:Hide Copy Code
    class CSampleTabDockingWindow :
             public dockwins::CBoxedDockingWindowImpl< SampleDockingWindow,
                    CWindow, dockwins::COutlookLikeBoxedDockingWindowTraits >
            typedef CSampleTabDockingWindow    thisClass;
            typedef dockwins::CBoxedDockingWindowImpl<CSAMPLEDOCKINGWINDOW,
             dockwins::COutlookLikeBoxedDockingWindowTraits>  baseClass;
Add Support for Auto-Hiding Features

To add auto-hiding features to your project just include a DWAutoHide.h header before any other docking windows headers.

Dock a Docking Window

Call the DockWindow methods from your frame window class.
Hide Copy Code

template<class T>
bool DockWindow(T& dockWnd,CDockingSide side,
                unsigned long nBar,float fPctPos,
                unsigned long nWidth, unsigned long nHeight);
Docking window.
Sides of the frame window to dock to
CDockingSide::sSingle force docking window to occupy the fulll width of the docking bar, combine this style with one of the following:
CDockingSide::sRight Dock to the right side of the frame window.
CDockingSide::sLeft Dock to the left side of the frame window.
CDockingSide::sTop Dock to the top side of the frame window.
CDockingSide::sBottom Dock to the bottom side of the frame window.
Index of dockbar to dock to, it’s zero-based.
The percent of the dock bar’s width that the docking window should use as top point.
The requested width (in pixels) of the docking window. If the docking window is vertical, this parameter actually represents the control bar height.
The requested height (in pixels) of the docking window. If the docking window is vertical, this parameter actually represents the control bar width.
Dock One Tabbed Docking Window to Another

Call the DockTo method of the tabbed docking window.
Hide Copy Code

bool DockTo(HWND hWnd,int index=0);
Tabbed docking window to dock to.
Zero-based index.
Float a Docking Window that is Docked

Call the Float methods from your docking window class.

bool Float() – restore previous floating position
bool Float(LPCRECT pRc, <br />UINT flags=SWP_SHOWWINDOW | SWP_NOACTIVATE,<br />HWND hWndInsertAfter=HWND_TOP) – float docking window and move to a specified location.
Pin-up Docking Window

Call the one of the PinUp methods of the tabbed docking window.
Hide Copy Code

bool PinUp(const CDockingSide& side);
bool PinUp(const CDockingSide& side, unsigned long width,
    bool bVisualize=false);
Sides of the frame window to pin-up to:
CDockingSide::sRight Pin-up to the right side of the frame window.
CDockingSide::sLeft Pin-up to the left side of the frame window.
CDockingSide::sTop Pin-up to the top side of the frame window.
CDockingSide::sBottom Pin-up to the bottom side of the frame window.
The requested width (in pixels) of the docking window.
Specifies the show state of the docking window after pinning.
Unpin Pinned Docking Window

Call Hide then Show methods of the pinned window to emulate the pin button press,
or call Float method to float a pinned docking window,
or call Hide method then call any functions that set docking window position.

Receive Notifications when the Docked State of a Docking Window Changes

Override the following member functions of your docking window class
void OnDocked(HDOCKBAR hBar,bool bHorizontal)
void OnUndocked(HDOCKBAR hBar)

Handle to the dockbar to docking to.
Docking window orientation.
Hide/Show a Docking Window

To hide/show a docking window simply call Hide()/ Show() or Togle() methods of the CTitleDockingWindowImpl class.

Specify Minimum Docking Window Size

You can specify minimum docking window size by overriding GetMinMaxInfo method of your docking window, like this:
Hide Copy Code

void GetMinMaxInfo(LPMINMAXINFO pMinMaxInfo) const
Preserve Docking Window Position

You can use following member functions of the CDockingWindowBaseImpl class:

bool GetDockingWindowPlacement(DFDOCKPOSEX* pHdr) const
bool SetDockingWindowPlacement(DFDOCKPOSEX* pHdr)
Replace Splitter Bar

If you do not like splitter bar you can make your own. If you just want to change it’s appearance probably the best way to derive it from CSimpleSplitterBar. And override Draw(),DrawGhostBar() etc. Then define your traits
Hide Copy Code

typedef CDockingFrameTraitsT <CMySplitterBar,
                WS_EX_APPWINDOW | WS_EX_WINDOWEDGE>  CMyDockingFrameTraits;

and apply it to base class of CMainFrame.

Make Custom Caption

Create a new caption class. You can derive it from CCaptionBase or from other available Caption classes. Then define DockingWindowTraits
Hide Copy Code

typedef CDockingWindowTraits<CMyCaption,
                       WS_OVERLAPPEDWINDOW | WS_POPUP | WS_VISIBLE |
                       WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
                       WS_EX_TOOLWINDOW> CMyTitleDockingWindowTraits;

and apply it to CTitleDockingWindowImpl.

Docking Window Classes

Docking Windows Frame Classes
CDockingFrameImplBase[DockingFrame.h] — this class provides basic docking window features.
CDockingFrameImpl [DockingFrame.h] — base class for a single document interface (SDI) frame window.
CMDIDockingFrameImpl [DockingFrame.h] — base class for a multiple document interface (MDI) frame window.
CDockingSiteImpl [DockingFrame.h] — base class for a generic window with docking window features.
CDockingFrameTraitsT [DockMisc.h] — traits of docking frame it’s derived from CWinTraits class and add TSplitterBar parameter.
Docking Windows Classes
CDockingWindowBaseImpl [DockingWindow.h] — base class for docking windows. The CDockingWindowBaseImpl class derives from CWindowImpl and has the same parameters except TWinTraits. Instead, it is uses CDockingWindowTraits.
CTitleDockingWindowImpl [DockingWindow.h] — titled docking window.
CBoxedDockingWindowImpl [DockingBox.h] — titled docking window which support tabbed docking.
CDockingWindowTraits [DockingWindow.h] — traits of docking window it’s derived from CWinTraitsclass and add TCaption parameter. If you need to customize the docking window caption, make new caption class and use CDockingWindowTraits with new class as TCaption parameter.
Docking Windows Captions Classes
CCaptionBase[DockingWindow.h] — base class for other caption class
COutlookLikeExCaption and COutlookLikeCaption [ExtDockingWindow.h] — Microsoft Outlook™ likes caption.
COutlookLikeCaption — always horizontal caption.
COutlookLikeExCaption — orientation of the caption depends on docking position.
CVC6LikeCaption [ExtDockingWindow.h] — Microsoft Visual C++ 6™ IDE like caption.
Docking Windows Traits Classes
COutlookLikeTitleDockingWindowTraits [ExtDockingWindow.h] traits for COutlookLikeCaption, use this class with CTitleDockingWindowImpl
COutlookLikeExTitleDockingWindowTraits [ExtDockingWindow.h] traits for COutlookLikeExCaption, use this class with CTitleDockingWindowImpl
CVC6LikeTitleDockingWindowTraits [ExtDockingWindow.h] traits forCVC6LikeCaption, use this class with CTitleDockingWindowImpl
COutlookLikeBoxedDockingWindowTraits [TabDockingBox.h] traits for COutlookLikeCaption, use this class with CBoxedDockingWindowImpl
COutlookLikeExBoxedDockingWindowTraits [TabDockingBox.h] traits for COutlookLikeExCaption, use this class with CBoxedDockingWindowImpl
CVC6LikeBoxedDockingWindowTraits[TabDockingBox.h] traits for CVC6LikeCaption, use this class with CBoxedDockingWindowImpl
Docking Windows Splitter Bar Classes
CSimpleSplitterBar[SimpleSplitterBar.h] – Very simple splitter bar.
CSimpleSplitterBarEx[SimpleSplitterBar.h] – another simple splitter bar.

“MDI WTL”의 95개의 댓글

  1. Excellent website you have here but I was curious about if you
    knew of any discussion boards that cover the same topics talked about in this article?

    I’d really like to be a part of community where I can get opinions from other knowledgeable people that share the same interest.
    If you have any suggestions, please let me know.
    Thank you!

  2. I’ve been exploring for a bit for any high-quality articles or weblog posts in this sort of space .
    Exploring in Yahoo I eventually stumbled upon this website.
    Studying this info So i am satisfied to express that I’ve a
    very excellent uncanny feeling I found out just what I needed.

    I such a lot unquestionably will make sure to
    do not overlook this website and provides it a look regularly.

  3. I simply want to tell you that I am beginner to blogging and absolutely liked you’re web site. Likely I’m want to bookmark your blog post . You amazingly come with perfect article content. With thanks for revealing your web site.

  4. Hello, i read your blog from time to time and i own a
    similar one and i was just wondering if you get a lot of spam
    responses? If so how do you prevent it, any plugin or anything
    you can suggest? I get so much lately it’s driving me mad so any
    help is very much appreciated.

  5. Excellent weblog here! Also your website so much up fast!

    What host are you using? Can I get your associate link on your host?

    I wish my web site loaded up as fast as yours lol

  6. I simply want to tell you that I am very new to weblog and really loved this web blog. Very likely I’m likely to bookmark your site . You certainly have really good writings. Regards for sharing with us your blog site.

  7. Howdy this is kind of of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

  8. You could definitely see your skills in the work you write. The sector hopes for more passionate writers like you who are not afraid to say how they believe. At all times follow your heart. “He never is alone that is accompanied with noble thoughts.” by Fletcher.

  9. Thanks , I’ve recently been looking for info about this topic for ages and yours is the greatest I’ve discovered so far. But, what about the conclusion? Are you sure about the source?

  10. There are some interesting closing dates on this article but I don’t know if I see all of them middle to heart. There may be some validity but I will take hold opinion till I look into it further. Good article , thanks and we want more! Added to FeedBurner as well

  11. Definitely believe that which you stated. Your favorite reason seemed to be on the net the simplest thing to be aware of. I say to you, I certainly get annoyed while people consider worries that they plainly don’t know about. You managed to hit the nail upon the top and defined out the whole thing without having side-effects , people could take a signal. Will likely be back to get more. Thanks

  12. Thanks for your article. It’s very unfortunate that over the last ten years, the travel industry has already been able to to deal with terrorism, SARS, tsunamis, influenza, swine flu, and also the first ever real global downturn. Through it all the industry has proven to be powerful, resilient in addition to dynamic, discovering new strategies to deal with hardship. There are often fresh issues and the opportunity to which the field must all over again adapt and react.

  13. The very root of your writing whilst appearing reasonable in the beginning, did not settle properly with me personally after some time. Somewhere throughout the paragraphs you actually were able to make me a believer but only for a short while. I nevertheless have a problem with your leaps in assumptions and one might do nicely to fill in those gaps. In the event you can accomplish that, I will definitely end up being fascinated.

  14. Hey there! This post couldn’t be written any better! Reading this post reminds me of my good old room mate! He always kept talking about this. I will forward this write-up to him. Pretty sure he will have a good read. Thanks for sharing!

  15. I just want to mention I am new to weblog and definitely loved this web page. Very likely I’m likely to bookmark your website . You absolutely have very good articles and reviews. Thank you for revealing your blog site.

  16. Hey there! I know this is somewhat off topic but I was wondering if you knew where I could locate a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having difficulty finding one? Thanks a lot!

  17. An impressive share! I have just forwarded this onto a friend who has been conducting a little research on this. And he actually bought me lunch due to the fact that I discovered it for him… lol. So allow me to reword this…. Thank YOU for the meal!! But yeah, thanx for spending some time to talk about this issue here on your blog.

  18. I’m impressed, I have to admit. Genuinely rarely do I encounter a weblog that’s both educative and entertaining, and without a doubt, you may have hit the nail within the head. Your idea is outstanding; the thing is an issue that not enough consumers are speaking intelligently about. My business is delighted that I stumbled across this within my search for some thing in regards to this.

  19. When I initially commented I seem to have clicked the -Notify me when new comments are added- checkbox and from now on each time a comment is added I recieve 4 emails with the same comment. Perhaps there is a way you can remove me from that service? Cheers.

  20. Nice post. I discover some thing tougher on different blogs everyday. Most commonly it is stimulating to study content off their writers and use a little from their site. I’d want to use some using the content in this little weblog whether or not you do not mind. Natually I’ll provide you with a link in your web weblog. Appreciate your sharing.

  21. This is the perfect site for everyone who wants to find out about this topic. You realize a whole lot its almost tough to argue with you (not that I personally will need to…HaHa). You definitely put a brand new spin on a subject that’s been written about for years. Great stuff, just wonderful.

  22. Oh my goodness! an incredible article dude. Thanks However I am experiencing trouble with ur rss . Do not know why Can not sign up for it. Could there be anyone getting identical rss issue? Anybody who knows kindly respond. Thnkx

  23. Having read this I believed it was rather enlightening. I appreciate you taking the time and effort to put this informative article together. I once again find myself spending a significant amount of time both reading and commenting. But so what, it was still worth it!

  24. obviously like your web site but you have to check the spelling on several of your posts. A number of them are rife with spelling problems and I in finding it very bothersome to tell the truth nevertheless I’ll surely come again again.

  25. Right here is the right web site for anybody who really wants to understand this topic. You understand a whole lot its almost hard to argue with you (not that I really will need to…HaHa). You definitely put a brand new spin on a subject which has been written about for a long time. Excellent stuff, just excellent.

  26. Your style is very unique in comparison to other folks I have read stuff from. I appreciate you for posting when you’ve got the opportunity, Guess I will just bookmark this page.

  27. The heart of your writing while sounding reasonable in the beginning, did not really settle very well with me personally after some time. Someplace within the paragraphs you were able to make me a believer unfortunately only for a short while. I nevertheless have a problem with your leaps in logic and one might do well to help fill in all those gaps. When you actually can accomplish that, I will undoubtedly be amazed.

  28. Hiya, I’m really glad I have found this info. Nowadays bloggers publish only about gossips and web and this is actually irritating. A good website with interesting content, this is what I need. Thank you for keeping this website, I will be visiting it. Do you do newsletters? Cant find it.

  29. Hello there! This is kind of off topic but I need some guidance from an established blog. Is it very difficult to set up your own blog? I’m not very techincal but I can figure things out pretty fast. I’m thinking about making my own but I’m not sure where to begin. Do you have any ideas or suggestions? Many thanks

  30. Simply desire to say your article is as astounding. The clarity to your post is simply great and that i can assume you’re knowledgeable on this subject. Well together with your permission allow me to grab your RSS feed to stay updated with approaching post. Thank you a million and please carry on the rewarding work.

  31. This is the first time I checked out your blog, and honestly, compared to your other posts, Self-Publishing: The New Way or the Short-Cut? | Chronicles of A Broken Spirit is much more well-written! Keep up the good work. Regards, Ricardo Kosloski

  32. Hello there! This post could not be written any better! Reading through this article reminds me of my previous roommate! He always kept talking about this. I am going to send this article to him. Pretty sure he’ll have a good read. Thank you for sharing!

  33. I seriously love your blog.. Pleasant colors & theme. Did you make this site yourself? Please reply back as I’m wanting to create my own site and would like to find out where you got this from or exactly what the theme is called. Kudos.

  34. There are a handful of intriguing points with time in this article but I do not determine if them all center to heart. There is certainly some validity but I’m going to take hold opinion until I explore it further. Good post , thanks therefore we want much more! Combined with FeedBurner at the same time

  35. May I simply just say what a relief to uncover an individual who actually knows what they are discussing over the internet. You definitely know how to bring a problem to light and make it important. More people should look at this and understand this side of the story. I can’t believe you are not more popular because you most certainly have the gift.

  36. The very next time I read a blog, I hope that it doesn’t disappoint me just as much as this one. After all, Yes, it was my choice to read, however I truly thought you would probably have something interesting to talk about. All I hear is a bunch of moaning about something that you can fix if you weren’t too busy seeking attention.

  37. Just wish to say your article is as surprising. The clarity in your post is just excellent and i can assume you’re an expert on this subject. Fine with your permission let me to grab your RSS feed to keep up to date with forthcoming post. Thanks a million and please carry on the gratifying work.

  38. I would like to thnkx for the efforts you’ve put in writing this website. I am hoping the same high-grade web site post from you in the upcoming as well. Actually your creative writing abilities has inspired me to get my own web site now. Really the blogging is spreading its wings fast. Your write up is a great example of it.

  39. Nice post. I be taught something tougher on completely different blogs everyday. It should at all times be stimulating to learn content material from different writers and practice a bit of one thing from their store. I’d want to use some with the content on my blog whether you don’t mind. Natually I’ll offer you a hyperlink on your net blog. Thanks for sharing.

  40. I have to thank you for the efforts you’ve put in writing this website. I’m hoping to see the same high-grade content by you later on as well. In truth, your creative writing abilities has inspired me to get my very own blog now 😉

  41. An outstanding share! I have just forwarded this onto a co-worker who has been doing a little homework on this. And he in fact ordered me dinner because I found it for him… lol. So allow me to reword this…. Thank YOU for the meal!! But yeah, thanx for spending the time to discuss this subject here on your web site.

댓글 남기기