In Windows Mobile, how does one remove the OK button of cstddialogimpl IN THE wtl dialog box?

Source: Internet
Author: User

 

Introduction

This article describes how to remove the OK button in the upper right corner of the wtl dialog box.

 

Problem

The dialog box inherited from the cstddialogimpl class has an OK button in the upper right corner by default. For example

Why is there this OK button?CodeIs inherited from cstddialogimpl <cconfigdialog>, and cconfigdialog is a custom class.

 
ClassCconfigdialog:PublicCstddialogimpl <cconfigdialog>,PublicCwindataexchange <cconfigdialog>
{
Public:
Begin_msg_map (cconfigdialog)
Chain_msg_map (cstddialogimpl <cconfigdialog>)
End_msg_map ()

 

Cstddialogimpl inherits from cstddialogimplbase. The default Shidi flags is wtl_std_shidif.

Template<ClassT, uint t_shidiflags = wtl_std_shidif,BoolT_bmodal =True>
ClassAtl_no_vtable cstddialogimpl:PublicCstddialogimplbase <t, t_shidiflags, t_bmodal>
{};

Wtl_std_shidif contains shidif_donebutton.

 
# DefineWtl_std_shidif shidif_donebutton | shidif_sipdown | shidif_sizedlgfullscreen

Shidif_donebutton is the OK button displayed in the upper right corner.

 

 

Implementation

To remove this button, follow these steps.

 

1. Modify the inheritance of cconfigdialog and inherit from cstddialogimpl <cconfigdialog, shidif_sizedlgfullscreen | shidif_sipdown>

ClassCconfigdialog:PublicCstddialogimpl <cconfigdialog, shidif_sizedlgfullscreen | shidif_sipdown>,
PublicCwindataexchange <cconfigdialog>
{
 
Public:
TypedefCstddialogimpl <cconfigdialog, shidif_sizedlgfullscreen | shidif_sipdown> cconfigdialogwithoutdone;

Begin_msg_map (cconfigdialog)
Chain_msg_map (cconfigdialogwithoutdone)
End_msg_map ()

You also need to modify chain_msg_map.

2. added the shdonebutton and modifystyle calls in the oninitdialog () function.

Lresult cconfigdialog: oninitdialog (uint umsg, wparam, lparam, bool & bhandled)
{
Shdonebutton (m_hwnd, shdb_hide );
Modifystyle (0, ws_nonavdonebutton, swp_nosize );
ReturnBhandled = false;
}

 

The result is as follows:

Refer to cstddialogimpl and the OK button

Related Article

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.