Solved

CToolBar

Posted on 2000-03-08
5
353 Views
Last Modified: 2013-11-20
VC6.0

I have a floating CToolbar in the CMainframe.  When the user closes the toolbar using the toolbar's [X] button, does the toolbar notifies the parent mainframe?

If yes, how do i catch this notification message?

If no, what should i do so that my Mainframe is aware that the toolbar has been closed by the user?

0
Comment
Question by:leowlf
[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
5 Comments
 
LVL 4

Expert Comment

by:inpras
ID: 2599108
Hi
Create UR own class say CMyToolBar
derive it from CToolBar
then chenge UR initial tool bar object to the type of CMyToolBar
Map WM_CLOSE of CMyToolBar U will get the notification
Hope this helps
0
 

Author Comment

by:leowlf
ID: 2599405
It doesn't work.  

The CMyToolBar::OnClose() wasn't called when the user closes the CMyToolBar using the toolbar's [x] button.

0
 
LVL 1

Accepted Solution

by:
nutsnuts earned 50 total points
ID: 2600937
Just implement the CMyToolBar as inpras has mentioned. But override the OnWindowPosChanged(WINDOWPOS FAR* lpwndpos) function. Write some codes like this:

      if (lpwndpos->flags & SWP_HIDEWINDOW)
      {
            //Here is your notification code;
      }

0
 
LVL 5

Expert Comment

by:vachooho
ID: 2602682
Do as inpras suggested
but map WM_SYSCOMMAND message
in the sys command handler add the following lines

void CMyToolBar::OnSysCommand(UINT nID, LPARAM lParam)
{
      if ((nID/* & 0xFFF0*/) == SC_CLOSE)
      {
// your toolbar is being closed
// notify parent
// say
GetParent()->PostMessage(WM_COMMAND, ID_TOOLBARCLOSING);
      }
      else
      {
            CToolBar::OnSysCommand(nID, lParam);
      }
}

and be sure you have changed
CToolBar m_wndToolBar;
to
CMyToolBar m_wndToolBar;

in your CMainFrame cpp file

Hope this helps
0
 

Author Comment

by:leowlf
ID: 2604049
NutsNuts's answer works.

vachooho's suggestion of using WM_SYSCOMMAND doesn't works in my application.  The void CMyToolBar::OnSysCommand(UINT nID, LPARAM lParam) is never called.

Thank you guys.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeateFront java challenge 31 101
Perl Awk Need Help 3 150
ffmpeg - "rtsp://...... Operation not permitted" 4 92
I could not set window to top 4 63
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: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

710 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