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

Source: Internet
Author: User

Translation: tellmenow

Other command line functions
There are many other functions used to help manage command lines. The commandbar_height function returns the height of the command bar and is used for all examples of using the command bar.Program. Similarly, the commandbar_addadornments function is used no matter when a command bar is used. The function is prototype as follows:
Bool commandbar_addadornments (hwnd hwndcb, DWORD dwflags, DWORD dwreserved );
You can add the [close], [help], and [OK] buttons to the rightmost side of the command bar. By setting the dwflags parameter to cmdbar_help, add the [help] button and set it to cmdbar_ OK to add the [OK] button.

The [help] button is different from other buttons on the command bar. When the [help] button is pressed down, the command bar sends the wm_help message to the owner of the command bar, rather than the standard wm_command message. The [OK] button is processed in the usual way. When you press it, a wm_command message with the Control ID idok will be sent. The commandbar_addadornments function can be called only after all other controls are added.

If the top-level window is adjustable, you must send a tb_autosize message to the command bar and call the bool commandbar_alignadornments (hwnd hwndcb) function when processing the wm_size message, to notify the command bar to adjust the size. The unique parameter of this function is the command bar handle.
You can hide or display command lines by calling the bool commandbar_show (hwnd hwndcb, bool fshow) function.
If fshow is set to true, the command bar is displayed. If fshow is set to false, the command bar is hidden.
You can use the bool commandbar_isvisible (hwnd hwndcb) function to check whether the command bar is visible.
You can use the void commandbar_destory (hwnd hwndcb) function to destroy command lines.
Although command lines are automatically destroyed when the parent window is destroyed, it is more convenient to manually destroy command lines. This is especially common when different application modes require new command lines. Of course, you can first create multiple command lines, show one of them and hide others, and then switch by displaying only one at a time. But in Windows CE, this is not a good programming habit, because all hidden command lines will occupy valuable Ram. The proper method is to destroy and create a command bar when you are idle. You can quickly create a command bar so that the user will not notice any delay.

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.