News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Trapping event notifications from a combobox.

Started by Lightman, November 19, 2015, 12:43:20 AM

Previous topic - Next topic

Lightman

Hello Everybody,

I am writing an example program showing interactions with a Combo Box. So far, I can communicate with this using SendMessage, getting and setting various options. But, I am having problems with the Windows notification side. The combo box will send out notifications that I can pick up like any other - button clicks and the like. The message comes in two parts. First I get the ID of the combo box in question - as there maybe more that one on the form. Then once I know which one is talking, I can then identify the message. The wParam contains the ID and the message, so pick up ID for the combo box and then shift wParam to the right to get the event itself.

Or, at least that is my theory, my attempt does not work....  :(

My code is attached, can someone point me in the direction of how I trap messages coming from the combo box?

Regards,

Lightman



Regards,

Lightman

TWell

Check CBN_SELCHANGE from MSDN
QuoteCBN_SELCHANGE Notification

--------------------------------------------------------------------------------

The CBN_SELCHANGE notification message is sent when the user changes the current selection in the list box of a combo box. The user can change the selection by clicking in the list box or by using the arrow keys. The parent window of the combo box receives this notification in the form of a WM_COMMAND message with CBN_SELCHANGE in the high-order word of the wParam parameter.

ragdog

A combobox has many Messages to recive

https://msdn.microsoft.com/en-us/library/aa928127.aspx

Lightman

Hi Everybody,

Although I know the messages I am looking to trap, I'm having problems actually trapping them. I thought my code would work, but something somewhere is wrong..


.elseif eax==IDC_CBO
; The Combo box is sending a message, but what is it?
mov eax, wParam
and edx, eax
shr edx, 16
.if ax==CBN_DROPDOWN
; The dropdown has been activated.
invoke MessageBox, hWnd, addr strNotice, addr AppName, MB_OK
.endif
.endif


Regards,

Lightman
Regards,

Lightman

Lightman

Hi Everybody,

Ah, got it!

The attached example will communicate both ways with the Combo Box...

Regards,

Lightman
Regards,

Lightman

dedndave

we generally do things the other way around
that is, we filter by message, notification, etc
THEN, by control ID
this is done because we may have more than one combobox - with similar code to handle notifications
have a look at some of the examples in masm32\examples
this applies to other control types, so it doesn't really have to be a combobox example

https://msdn.microsoft.com/en-us/library/windows/desktop/ff485902%28v=vs.85%29.aspx

Lightman

Hi Everybody,

I've re-jigged the WM_COMMAND section of the code so it's processed as is should be. Reading through the code, it does make more sense. The dialog now supports multiple ComboBoxes and shows a small range of ComboBox functions.

Code and EXE attached.

Regards,

Lightman
Regards,

Lightman