zoukankan      html  css  js  c++  java
  • IE中ocx控件的无模式对话框不接收方向键等键盘消息的问题的解决办法

    在ocx控件中如果含有无模式对话框,那么当ocx在ie中显示时,往往接收不到
    诸如tab,方向键和退格键。所有这些消息都被IE容器给截取了,对于这个问题,ms给出了解决方法:
    首先:
      int CMyActiveXCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
       {
          if (COleControl::OnCreate(lpCreateStruct) == -1)
             return -1;
          OnActivateInPlace (TRUE, NULL); // == UI-Activate the control
          return 0;
       }
     激活控件,以便能接收键盘消息。
    其次 跟踪转发消息
      // 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);
       }
    注意用send而不要用post
  • 相关阅读:
    在linux上安装python, jupyter, 虚拟环境(virtualenv)以及 虚拟环境管理之virtualenvwraper
    linux
    Django ORM那些相关操作
    Django 中 form 介绍
    MySQL完整性约束
    git入门
    MySQL表的操作
    努力努力再努力
    Docker初始
    IO模型
  • 原文地址:https://www.cnblogs.com/lidabo/p/2981862.html
Copyright © 2011-2022 走看看