[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Menus

Posted on 1998-04-22
4
Medium Priority
?
248 Views
Last Modified: 2012-05-04
OK.  This is probably the stupid question of the day, but I can't seem to find the answer.

I have created a form with a menu.  Everything is working properly, but I need to know what message is posted to the WindowProc when the menu is clicked.  For example, if someone clicks on File | Exit, and the ID of the exit menu is IDR_EXIT, what message gets posted to the WindowProc?
0
Comment
Question by:dirtdart
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 400 total points
ID: 1251493
WM_COMMAND.

PS.  This is a "Windows" question, not a "C" question
0
 
LVL 11

Expert Comment

by:alexo
ID: 1251494
The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated.

WM_COMMAND :

wNotifyCode = HIWORD(wParam); // notification code
wID = LOWORD(wParam);         // item, control, or accelerator identifier
hwndCtl = (HWND) lParam;      // handle of control
 
Parameters:

wNotifyCode - Value of the high-order word of wParam. Specifies the notification code if the message is from a control. If the message is from an accelerator, this parameter is 1. If the message is from a menu, this parameter is 0.

wID - Value of the low-order word of wParam. Specifies the identifier of the menu item, control, or accelerator.

hwndCtl - Value of lParam. Identifies the control sending the message if the message is from a control. Otherwise, this parameter is NULL.
 
Return Values - If an application processes this message, it should return zero.

Remarks:

Accelerator keystrokes that select items from the window menu are translated into WM_SYSCOMMAND messages.

If an accelerator keystroke occurs that corresponds to a menu item when the window that owns the menu is minimized, no WM_COMMAND message is sent. However, if an accelerator keystroke occurs that does not match any of the items in the window's menu or in the window menu, a WM_COMMAND message is sent, even if the window is minimized.

If an application enables a menu separator, the system sends a WM_COMMAND message with the low-word of the wParam parameter set to zero when the user selects the separator.

0
 
LVL 11

Expert Comment

by:alexo
ID: 1251495
There are no stupid questions.  Only stupid answers.
0
 
LVL 5

Author Comment

by:dirtdart
ID: 1251496
Well, that's what I thought in the first place.  I guess I must have typed something wrong the first time I tried it with WM_COMMAND, cause it didn't work then, but it does now.  Well, live and learn.  I just wish Microsoft would include more documentation on Win32 and not just MFC.  I personally think MFC bites and try to avoid it at every possible opportunity.

Thanks for the help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

649 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