Hi, all,
I am doing my app on smartphone devices with Visual Studio 2005, and I am using DialogBox() function to create a dialog box instead of initializing an object of DialogBox class. I am just wondering how I can insert a menu bar to a dialog box by calling the DialogBox() function
Thanks in advance

How to Insert a Menu bar to a DialogBox()?
polymorphicx
Hi,
As per the msdn documentation http://msdn.microsoft.com/library/default.asp url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/dialogbox.asp we do get a WM_INITDIALOG message in the dialog procedure. You shall need to use ::SHCreateMenuBar with the appropriate resoureces to created the menubar while handling this message, just as you do it in the OnInitDialog handler; see http://msdn.microsoft.com/library/default.asp url=/library/en-us/wceshellui5/html/wce50lrfSHCreateMenuBar.asp.
Hope this helps.
Thanks.
Daniel_laksjdhfg
Toni Greco
SHCreateMenuBar will fail for a Windows Mobile 5.0-based Smartphone
So, if there is another to insert a menu bar into a dialog box in WM 5.0 by calling DialogBox function to create a modal dialog
Thanks for all your help! Appreciate it!
nishanttheone
Hi,
Relax :), if you read it again it says that the method shall fail - "if If the specification passed to SHCreateMenuBar function contains images or more than 2 top level menu items, the behavior is as follows.", which means you can't have images in the commandbar and more that 2 menus ( one each for the h/w buttons). As long as you follow these you should be fine. For more infromation on the layout of resources have a look at the first image here http://avinashprasad.spaces.msn.com/photos/
Hope this helps.
Thanks