PreTranslateMessage DoModal () ASSERT (:: IsWindow (M_hwnd)

Source: Internet
Author: User

PreTranslateMessage function Call DoModal () The following bug! appears when you close the dialog box

Cause analysis: in the PreTranslateMessage to obtain the corresponding m_hwnd,DoModal () modal dialog box exits,m_hwnd is not a valid window handle, Need to return rrue

Workaround: After you finish processing the keyboard message in PreTranslateMessage , do a couple of steps :

1. Reset Focus

2,return TRUE


Enter key: Enter the current selected module if (Pmsg->wparam = = Vk_return) {if (Countenter = = 2) {if (:: IsWindow (GetSafeHwnd ())) {pdlg-> Pdlgpgzb->onbnclickedbtadd ();//  bn_clicked called DoModal ()////p: Return to the focus position && call Dlgmethod back return 1;pdlg->pdlgpgzb->setfocus ();pD lg->pdlgpgzb->m_list_method.setitemstate (0, LVIS_SELECTED| lvis_focused, lvis_selected| lvis_focused); Setcursorpos (120,210); return 1;}}






Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

PreTranslateMessage DoModal () ASSERT (:: IsWindow (M_hwnd)

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.