Solve the Chinese problem of the MASM programming dialog box

Source: Internet
Author: User
Tags ustring

The ustring macro in the Dialog. inc file in MASM32 is faulty. As a result, a problem occurs when a Dialog box containing Chinese characters is displayed using a macro related to the Dialog box. The original code is as follows:

    ; ------------------------------------------------    ; write unicode string at current location in EDI    ; ------------------------------------------------      ustring MACRO quoted_text        LOCAL asc_txt      .data        asc_txt db quoted_text,0      .code        invoke MultiByteToWideChar,CP_ACP,MB_PRECOMPOSED,               ADDR asc_txt,-1,edi,LENGTHOF asc_txt        add edi, LENGTHOF asc_txt*2      ENDM

After modification to the following:

    ; ------------------------------------------------    ; write unicode string at current location in EDI    ; ------------------------------------------------      ustring MACRO quoted_text        LOCAL asc_txt,dwMinSize      .data        asc_txt db quoted_text,0        dwMinSize dd 0      .code        invoke MultiByteToWideChar,CP_ACP,0, ADDR asc_txt,-1,0,0         mov dwMinSize,eax        invoke MultiByteToWideChar,CP_ACP,MB_PRECOMPOSED, ADDR asc_txt,-1,edi,dwMinSize        add edi, dwMinSize        add edi, dwMinSize      ENDM

For details about how to use the MultiByteToWideChar function, refer to the MSDN library.

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.