say in Win 32 API, when a user clicks on a progress bar or a status bar, and i want something to occur as a result, how do i capture that event? im sure there must be some WM_COMMAND code or something.
ps
by da way, this is MSVC++
say in Win 32 API, when a user clicks on a progress bar or a status bar, and i want something to occur as a result, how do i capture that event? im sure there must be some WM_COMMAND code or something.
ps
by da way, this is MSVC++
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
Subclass the control
You have to create a callback for it, set it to the control's callback, and call the original callback each time through.
look up subclassing a window on MSDN. There's an example there somewhere.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
The common controls send notification messages to their parent window in the form of WM_NOTIFY which are sort of analagous to the WM_COMMAND sent by standard or user controls (buttons, edits, etc). [Note that common controls may still also send notifications in the form of WM_COMMAND messages; check the specific control on msdn for more details.]
The LPARAM of the WM_NOTIFY is a pointer to a NMHDR structure, and the 'code' parameter of this structure contains a specific notification message.
Ones of interest to you in this regard are NM_CLICK (mouse left-click) and NM_RCLICK (mouse right-click).
There are many more notifications sent in this manner which you can also test for, some general to all common controls, some specific to particular common controls.
If you find that this WM_NOTIFY mechanism is insufficient for your needs then window subclassing, as FillYourBrain has suggested, remains a viable option.
Hope that helps.
and some child windows send their parents callback a WM_PARENTNOTIFY msg for mouse clicks.
Code:case WM_PARENTNOTIFY: { //may want to see which control sent the message if(WM_RBUTTONDOWN==(WPARAM)wParam)
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
WM_NOTIFY works for status bars but not for progress bars. does this mean i have to use window subclassing?
is the callback procedure mentioned by fillyourbrain similar to a window procedure? if so, how do i specify the procedure for the control?
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials