Solution to the problem that OCX controls do not receive direction keys and other keyboard messages in the modeless dialog box of IE

Source: Internet
Author: User
If the OCX control contains a non-modal dialog box, when OCX is displayed in IE, it often does not receive tabs, direction keys, and backspace keys. All these messages are intercepted by the IE container. For this problem, Ms provides a solution: first: Int cmyactivexctrl: oncreate (maid)
{
If (colecontrol: oncreate (lpcreatestruct) =-1)
Return-1;
Onactivateinplace (true, null); // = UI-activate the control
Return 0;
}
Activate the control to receive keyboard messages.Second, tracking and forwarding messages // Trap keys and forward on to the control
Bool cmyactivexctrl: pretranslatemessage (MSG * PMSG)
{
Switch (PMSG-> message)
{
Case wm_keydown:
Case wm_keyup:
Switch (PMSG-> wparam)
{
Case vk_up:
Case vk_down:
Case vk_left:
Case vk_right:
Case vk_home:
Case vk_end: Case vk_tab:
: Sendmessage (PMSG-> hwnd, PMSG-> message, PMSG-> wparam, PMSG-> lparam );
// Windowless controls won't be able to call sendmessage.
// Instead, just respond to the message here.
Return true;
}
Break;
}
Return colecontrol: pretranslatemessage (PMSG );
}Note that use send instead of post. Other References: http://support.microsoft.com/kb/q168777/http://www.microsoft.com/msj/0795/dilascia/dilascia.aspx

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.