Solved

CDialogBar and message notification trouble.

Posted on 1998-10-05
4
381 Views
Last Modified: 2013-11-20
Env: Windows NT 4.0/SP3, Visual C++ 5.0/SP3.

I'm trying to use a dockable CDialogBar in a SDI application, where the CDialogBar has a control (CStatic derived, Notify property enabled). I have added message handlers for WM_LBUTTONDOWN/WM_LBUTTONUP in the derived CStatic class, but no such messages arrives. How can they be enabled?
0
Comment
Question by:stefanr
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
plaroche earned 100 total points
ID: 1322919
The static control sends notifications to its parent when it has been created with the SS_NOTIFY style. Those notifications are:

STN_CLICKED  
STN_DBLCLK  
STN_DISABLE  
STN_ENABLE  
WM_CTLCOLORSTATIC

You can get that notification with OnCommand as stated in the doc for STN_CLICKED, example:

BOOL CYourWnd::OnCommand(WPARAM wParam, LPARAM lParam)
{
    WORD wNotifyCode = HIWORD(wParam); // notification code
    WORD wID = LOWORD(wParam);         // item, control, or accelerator identifier
    HWND hwndCtl = (HWND)lParam;      // handle of control       

    switch( wNotifyCode ) {
    case STN_CLICKED:
        break;
    }

      return CWnd::OnCommand(wParam, lParam);
}


0
 
LVL 1

Expert Comment

by:MuraliKrishna
ID: 1322920
You need to add the message handlers in one of the following classes:
Frame, View, Document or App.

Only these classes get messages from controls on a CDialogBar.

Regards,
Murali Krishna Devarakonda
0
 
LVL 3

Author Comment

by:stefanr
ID: 1322921
Plaroche, thank you for the answer. I tried it, and it worked as you said it would. Thanks to that I could experiment a little, and I saw that the variable created with ClassWizard was not subclassed properly. When I did that manually, it worked as I wanted in the first place. So even if I'm not using the solution you provided me, it helped to get me to get on the right track.
0
 
LVL 3

Author Comment

by:stefanr
ID: 1322922
Plaroche, thank you for the answer. I tried it, and it worked as you said it would. Thanks to that I could experiment a little, and I saw that the variable created with ClassWizard was not subclassed properly. When I did that manually, it worked as I wanted in the first place. So even if I'm not using the solution you provided me, it helped to get me to get on the right track.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now