How to define the structure of Menubar in Smartphone

xiaoxiao2021-03-31  221

To use ShcreateMenubar in SP to create a menubar, you need the following conditions:

1) Define resources in RC and RC2 in the resource file.

Yourrappname.r:

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

IDR_MENU2 MENU (Menu This definition is right next to display the pop-up menu, IDR_MENU2 is Resrouce_ID, will be used in YouAppName.rc2) BEGIN POPUP "MenuRoot" (subMenuIndex: 0) BEGIN MENUITEM "MenuOne", ID_MENUROOT_MENUONE MENUITEM "MenuTwo", ID_MENUROOT_MENUTWO POPUP "MenuThrid" BEGIN MENUITEM "CAMENU1", ID_MENUTHRID_CAMENU1 MENUITEM "CAMENU2", ID_MENUTHRID_CAMENU2 END END POPUP "SecMenu" POPUP "MenuRoot" (subMenuIndex: 1) BEGIN MENUITEM "! SEC_", ID_SECMENU_SEC MENUITEM "SEX-2", ID_SECMENU_SEX ENDEND

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

Yourappname.RC2 defines the resource structure of Shmenubar

IDR_MAINFRAME SHMENUBAR DISCARDABLE (IDR_MAINFRAME is the resource id used in ShcreateMemnubar, Shmenubar is the resource type, must not be wrong.) Begin idR_Menu2, (this is the menu resource ID of the menu defined in the RC file, " (Show a button or two buttons) i_imagenone, IDOK (this is the ID used in the program to distinguish the soft key), tbstyle_enabled, tbstyle_button | tbstyle_autosize, ids_ok (Softkey display string, this Unrelated to POPUP), 0, Nomenu (no pop-up menu), i_imagenone (this value is this value), IDM_RSKButton, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSUE (with pop-up menus, I must be tbstyle_dropdown), IDS_OK, 0, 1 (here is 0 or the book such as 1. or 2, n is the most important because he decided that the MENU corresponding to the Popup will be displayed.), End ------------------- ------------------------------, in fact, in the resource file, there are RC and RC2 differences, according to MSDN, RC2 Just for convenience of defining some less data, if you want to display the menu, you must clear the definition format of these two files.

For example, want to display 2 buttons, and a right-click menu. Note: Don't think that the top items (that is, the popup item) is the button on the right.

IDR_MAINFRAME is the IDIDR_MENU2 used by Shmenubarinfo when creating Shmenubar (this is to define it in the resource file) IDM_LEFT is the button of the left button (this ID is to capture the user selection after the user selection " It is to identify the user's choice) IDM_Right is the right button (this is the most critical, I have been confused, thinking that in the RC resource editor, set the top item here will pop up Menu, this is also a value of a uint type, and if you want to play, the property is set to.) TBStyle_Dropdown | TBStyle_Autosize is an option that can pop up a menu.

转载请注明原文地址:https://www.9cbs.com/read-131001.html

New Post(0)