Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CDialogBar and message notification trouble.

Posted on 1998-10-05
4
Medium Priority
?
433 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
[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
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
plaroche earned 300 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:Murali Devarakonda
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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

722 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