Click here to Skip to main content
15,904,024 members
Home / Discussions / C#
   

C#

 
GeneralRe: SearchDirectory Pin
Pete O'Hanlon4-Jun-13 7:07
mvePete O'Hanlon4-Jun-13 7:07 
GeneralRe: SearchDirectory Pin
Jasmine25015-Jun-13 11:58
Jasmine25015-Jun-13 11:58 
GeneralRe: SearchDirectory Pin
Pete O'Hanlon5-Jun-13 12:14
mvePete O'Hanlon5-Jun-13 12:14 
GeneralRe: SearchDirectory Pin
Jasmine25013-Jun-13 12:31
Jasmine25013-Jun-13 12:31 
GeneralRe: SearchDirectory Pin
HubSnippets10-Jun-13 0:47
HubSnippets10-Jun-13 0:47 
GeneralRe: SearchDirectory Pin
Bernhard Hiller3-Jun-13 21:10
Bernhard Hiller3-Jun-13 21:10 
GeneralRe: SearchDirectory Pin
HubSnippets10-Jun-13 0:20
HubSnippets10-Jun-13 0:20 
QuestionSending messages to a listbox's context menu. Pin
Septimus Hedgehog2-Jun-13 22:28
Septimus Hedgehog2-Jun-13 22:28 
Guys, this is quite simple I'm sure but I can't see the knockout punch leading to a solution. Without going into reasons but I'd like to send a right-click context menu message to a control. For example:

On a form, I've got a listbox, a button, and a context menu. I've set the listbox property to use the context menu. On the menu, I've added a few test items and I've added a messagebox to each one when selected. So, when I run the app, I can right-click on the listbox, select an item from the popup menu and yup, the messagebox is displayed. That's all fine.

Coming back to the button: I want to call SendMessage using the handle of the listbox. I'd like to send a right-click command, then select one of the menu items, blah-blah-blah. Getting the handle of the listbox isn't a problem but what is proving awkward is knowing what values I need to pass to SendMessage. I've got it declared as a dllimport and the usual declaration is

SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);

What I can't find out is what values I need to pass into wMsg, wParam, and lParam.

There's a0x7B declaration defined in a previous CP question[^] which is associated with a context menu so perhaps that's what I need to use for the wMsg parameter. If that's the right message command to use does anyone know what I'd set the other two parameters to?

So, on one click I'd like to select say, the second menu item, elsewhere, perhaps select the fifth menu item. If I can get it to work on a simple test app I'll be able to apply it to our production app. Any help appreciated - as usual.
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

AnswerRe: Sending messages to a listbox's context menu. Pin
DaveyM693-Jun-13 0:15
professionalDaveyM693-Jun-13 0:15 
GeneralRe: Sending messages to a listbox's context menu. Pin
Septimus Hedgehog3-Jun-13 0:46
Septimus Hedgehog3-Jun-13 0:46 
AnswerRe: Sending messages to a listbox's context menu. Pin
DaveyM693-Jun-13 0:55
professionalDaveyM693-Jun-13 0:55 
GeneralRe: Sending messages to a listbox's context menu. Pin
Septimus Hedgehog3-Jun-13 1:00
Septimus Hedgehog3-Jun-13 1:00 
GeneralRe: Sending messages to a listbox's context menu. Pin
DaveyM693-Jun-13 1:10
professionalDaveyM693-Jun-13 1:10 
GeneralRe: Sending messages to a listbox's context menu. Pin
Septimus Hedgehog3-Jun-13 1:54
Septimus Hedgehog3-Jun-13 1:54 
GeneralRe: Sending messages to a listbox's context menu. Pin
BobJanova3-Jun-13 4:06
BobJanova3-Jun-13 4:06 
GeneralRe: Sending messages to a listbox's context menu. Pin
Septimus Hedgehog3-Jun-13 5:53
Septimus Hedgehog3-Jun-13 5:53 
QuestionRun-time video editing Pin
yassine7072-Jun-13 14:55
yassine7072-Jun-13 14:55 
AnswerRe: Run-time video editing Pin
Richard MacCutchan2-Jun-13 20:51
mveRichard MacCutchan2-Jun-13 20:51 
QuestionHow to Open Cash Drawer Pin
Jassim Rahma2-Jun-13 10:26
Jassim Rahma2-Jun-13 10:26 
AnswerRe: How to Open Cash Drawer Pin
dusty_dex2-Jun-13 11:04
dusty_dex2-Jun-13 11:04 
GeneralRe: How to Open Cash Drawer Pin
Jassim Rahma2-Jun-13 11:17
Jassim Rahma2-Jun-13 11:17 
GeneralRe: How to Open Cash Drawer Pin
dusty_dex2-Jun-13 22:08
dusty_dex2-Jun-13 22:08 
AnswerRe: How to Open Cash Drawer Pin
dusty_dex3-Jun-13 2:02
dusty_dex3-Jun-13 2:02 
QuestionBinary Validation File Pin
Jassim Rahma2-Jun-13 10:25
Jassim Rahma2-Jun-13 10:25 
AnswerRe: Binary Validation File Pin
Mycroft Holmes2-Jun-13 11:53
professionalMycroft Holmes2-Jun-13 11:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.