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.