Solved

CDialogBar and message notification trouble.

Posted on 1998-10-05
4
406 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: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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 108
Installing Microsoft R server on REDHAT or SUSE Linux 4 147
WinWaitActive parameters 12 31
sumDigits challenge 9 170
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

856 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