The Return Value of the actievx control attribute is always true.

Source: Internet
Author: User

Symptom: When the attribute of the actievx control is variant_bool, the return value of get is always true on the client.

Cause: the MFC is converted during the transfer process, but the variant_boo is short type. The MFC is indeed converted to DWORD, so the conversion is always true. (For details, see the 1100 rows in oledisp1.cpp under vc2003 ). Method: Set the return value of "get" to "DWORD.

In addition, set values are different from those of variant_true and variant_false,

Correct use is shown in the following example:

Declaration: DWORD getflat1 (void );

Void setflat1 (variant_bool newval );

Definition: DWORD cbuttonst1ctrl: getflat1 (void)

{

Afx_manage_state (afxgetstaticmodulestate ());

// Todo: add the scheduling handler code here

If (m_bisflat)

{

Return variant_true;

}

Else

{

Return variant_false;

}

}

 

Void cbuttonst1ctrl: setflat1 (variant_bool newval)

{

Afx_manage_state (afxgetstaticmodulestate ());

// Todo: add the property handler code here

If (newval = 1)

{

M_bisflat = true;

}

If (newval = 0)

{

M_bisflat = false;

}

Invalidatecontrol ();

Setmodifiedflag ();

}

 

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.