How to remove the "new" button on the commandbar In the SDI Program

Source: Internet
Author: User

Today, on the Forum, I saw someone asking this question. Let me explain my method. If you have a better method, please contact us:

1. For evc4,
In the int cmainframe: oncreate (maid) function, run the following statement: m_wndcommandbar.m_bshowsharednewbutton = true;
To:
M_wndcommandbar.m_bshowsharednewbutton = false;

2. vs2005
Manually edit the. RC2 file (assuming your project name is MyApp), that is, edit MyApp. RC2 (located under MyApp/RES ),
The default content is:
Idr_mainframe shmenubar discardable
Begin
Idr_mainframe,
2,

I _imagenone, id_file_new, tbstate_enabled, tbstyle_button | tbstyle_autosize,
Ids_new, 0, nomenu, ----- This is the "new" button

I _imagenone, idm_menu, tbstate_enabled, tbstyle_dropdown | tbstyle_autosize, --- this is "menu"
Ids_menu, 0, 0,
End

If you only want to remove the new button: Example project 1
You can change it to the following:
Idr_mainframe shmenubar discardable
Begin
Idr_mainframe,
1,
I _imagenone, idm_menu, tbstate_enabled, tbstyle_dropdown | tbstyle_autosize, --- this is "menu"
Ids_menu, 0, 0,
End

If you want to replace it with another button-top-level menu, for example, the string table in the "test" resource editor is: ids_test
Of course, you also need to add the menu in the resource editor: Example project 2
(Of course, you need to add event/message processing functions to the buttons)
NOTE: If VS 2005 SP1 is installed, you only need to clear the idr_mainframe segment in the. RC2 file and add corresponding menu resources. The same below.

Idr_mainframe shmenubar discardable
Begin
Idr_mainframe,
2,

I _imagenone, idm_menu, tbstate_enabled, tbstyle_button | tbstyle_autosize,
Ids_test, 0, nomenu,

I _imagenone, idm_menu, tbstate_enabled, tbstyle_dropdown | tbstyle_autosize,
Ids_menu, 0, 1, // you can change it to your favorite menu.
End

If neither of the Left or Right soft key menus is a top menu, you can modify it as follows: Example project 3

Idr_mainframe shmenubar discardable
Begin
Idr_mainframe,
2,

I _imagenone, idm_menu, tbstate_enabled, tbstyle_dropdown | tbstyle_autosize,
Ids_test, 0, 0,

I _imagenone, idm_menu, tbstate_enabled, tbstyle_dropdown | tbstyle_autosize,
Ids_menu, 0, 1, // you can change it to your favorite menu.
End

The above is mainly for the only two menus, but the interface design recommended by MS is that two menus are recommended for Windows Mobile 5.0, and common functions are available on the left.

However, you can modify the text on the soft key menu in the following ways:

1 tbbuttoninfo btninfo;
2btninfo. cbsize = sizeof (tbbuttoninfo );
3btninfo. dwmask = tbif_text;
4btninfo. psztext = sztext; // The text to be replaced
5 sendmessage (
6 g_hwndmenubar,
Tb_setbuttoninfo,
Idm_main_menu_left,
(Lparam) (lptbbuttoninfo) & btninfo );

This problem does not exist for smartphone. You only need to create a menu in the resource editor and then use
Create shcreatemenubar (& shmbi. It can also be dynamically created.

Find a useful article on the Internet:
Windows Mobile 5.0 and Pocket PC menus

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.