-Windows CE programming (3rd edition)-5.2 Public controls (7)

Source: Internet
Author: User

Configure a single zoneTranslation:Tellmenow

At this point, the command Belt control has been created, and a single zone has been added to the control. Next we have more tasks to do, that is, to configure separate command bar controls in each band. (In fact, configuring the command bar control is slightly more complex than the command bar described above .)

You can use the following function to obtain the command bar handle in a zone:
Hwnd commandbands_getcommandbar (hwnd hwndcmdbands, uint uband );
Ubnadis a zone-based 0 index that contains the command bar. When this function is called when the command Belt control is initialized, the index value is directly associated with the order in which the Belt control is added. However, once the user has the opportunity to drag the band to a new order, your application must send the rb_idtoindex message to the command Belt control to obtain the index value, as shown below:
Nindex = sendmessage (hwndcmdbands, rb_1_index, id_band, 0 );

This message is very important for management of the band, because many functions and messages need to use the band index to identify the band. The problem is that the index value is not fixed because the index value changes because the user moves the band. Do not expect the index value to be consistent. As a rule, do not blindly use the index value before you use rb_idtoindex to query the index value.

Once you get the command bar window handle and use the standard command bar control function and message, you can easily add the menu or button to the command bar. In most cases, add only menus in the first command bar, add only buttons in the second, and add other controls to the third and subsequent command lines.

The following code completes the creation process mentioned above. First, the command bar control in the first two zones is initialized. Because the third zone has an editing control, you do not need to initialize the zone. The last line of code is to call the commandbands_addadornments function to add the close button to the control.
// Add menu to first band.
Hwndband = commandbands_getcommandbar (hwndcb, 0 );
Commandbar_insertmenubar (hwndband, hinst, id_menu, 0 );

// Add standard buttons to second band.
Hwndband = commandbands_getcommandbar (hwndcb, 1 );
Commandbar_addbitmap (hwndband, hinst_commctrl, idb_std_small_color, 15, 0, 0 );
Commandbar_addbuttons (hwndband, dim (tbcbstdbtns), tbcbstdbtns );

// Add exit button to command band.
Commandbands_addadornments (hwndcb, hinst, 0, null );

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.