Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7945111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:45:30+00:00 2026-06-04T00:45:30+00:00

I have the Windows event values that for example the DefWindowsProc() gets — i.e.

  • 0

I have the Windows event values that for example the DefWindowsProc() gets — i.e. hWnd, MsgId, wParam, lParam. Is it possible to distinguish whether the WM_COMMAND event with notification code BN_CLICKED comes or from a push button, or from a check box (or possibly from some other)?

Motivation: I am rewriting the GUI implementation and message handling in a bigger application. The final goal is wxWidgets, but I have to do it gradually. I do mimick the BEGIN_EVENT_TABLE/END_EVENT_TABLE macros and the related EVT_BUTTON, EVT_CHECKBOX (…, EVT_SIZE, EVT_PAINT and the like). I am also mimicking classes like wxCommandEvent, and I would like to set its type to the equivalent of wxEVT_COMMAND_BUTTON_CLICKED or wxEVT_COMMAND_CHECKBOX_CLICKED when the event is captured by the original code.

For example: I have a macro like this

#define EVT_CHECKBOX(id, func) \
    if (uMsg == WM_COMMAND && id == LOWORD(wParam)) \
    { \
        CAppCommandEvent evt(hWnd, uMsg, wParam, lParam); \
        ATLASSERT(evt.GetEventType() == appEVT_COMMAND_CHECKBOX_CLICKED); \
        func(evt); \
        lResult = evt.GetLResult(); \
        if (!evt.GetSkipped()) \
            return TRUE; \
    }

The wxEVT_COMMAND_CHECKBOX_CLICKED is intentionally renamed to appEVT_.... I want to be able to check whether the EVT_CHECKBOX macro was not used (by mistake) for a button. If yes, the assert command must make it visible for the debug version of the program.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:45:32+00:00Added an answer on June 4, 2026 at 12:45 am

    Nothing in the message itself can serve you to identify the type of button. However, in theory you should still be able to find it out indirectly. The lParam gives you the window handle of the control, which you can use with GetWindowLong to obtain the button style.

    LONG style = ::GetWindowLong(lParam, GWL_STYLE);
    if (style & BS_CHECKBOX) {
        // It's a checkbox
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C# Windows Form application that contains a menu with this event:
I have idea to write errors from my application to the Windows Event Viewer
I have a System.Windows.Forms.ComboBox on a form and I want to capture the event
I have a deferred function that binds a mouseenter event: $(window).load(function(e) { var $container
A have a KendoUI window that gets its content from a partial view. That
I have a form with label that is updating by System.Windows.Forms.Timer control every 2
When unzipping files in Windows, I'll occasionally have problems with paths that are too
Input rz value In the head I have: Event.observe(window, 'load', function() { $$(input).each(function(field){ Event.observe(field,
I have an Windows application treats Windows key events. The application conveys the Windows
I have the following javascript: $('#ge-display').click(function (event) { window.open('/googleearth/ge-display.php','','scrollbars=yes,menubar=no,height=650,width=1000,resizable=yes,toolbar=yes,location=no,status=no'); event.stopPropagation(); return false; }); the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.