我用VC做一ActiveX新建一dialog,用模态方式打开,可以正常响应消息.
但改用非模态方式打开,无论是母窗体中,还是dialog中,都不响应PreTranslateMessage,onkeydown之类的事件.
怎么回事,应怎么解决
请哪位大虾帮忙,谢谢!!!

解决方案 »

  1.   

    to happyparrot:父窗口就是自动创建的COleControl
      

  2.   

    你是怎么创建的??,为什么父窗口会是COleControl,COleControl是否WindowLess的
      

  3.   

    Windowless Controls
    OLE controls can be used in-place active without a window. Windowless controls have significant advantages: Windowless controls can be transparent and non-rectangular
    Windowless controls reduce instance size and creation time of the object 
    Controls do not need a window. Services that a window offers can easily be provided via a single shared window (usually the container’s) and a bit of dispatching code. Having a window is mostly an unnecessary complication on the object.When windowless activation is used, the container (which does have a window) is responsible for providing services that would otherwise have been provided by the control’s own window. For example, if your control needs to query the keyboard focus, query the mouse capture, or obtain a device context, these operations are managed by the container. The COleControl windowless-operation member functions invoke these operations on the container. When windowless activation is enabled, the container delegates input messages to the control’s IOleInPlaceObjectWindowless interface (an extension ofIOleInPlaceObject for windowless support). COleControl’s implementation of this interface will dispatch these messages through your control’s message map, after adjusting the mouse coordinates appropriately. You can process these messages like ordinary window messages, by adding the corresponding entries to the message map.In a windowless control, you should always use the COleControl member functions instead of the corresponding CWnd member functions or their related Windows API functions.
      

  4.   

    不是WindowLess,
    如果activex只是COleControl中是能正确响应所有消息的,因我原有个程序中dialog,已经包含了整个完整代码,
    我本想将dialog加入这个activex,
    从COleControl中非模态show这个dialog,
    但模态调用出来时,dialog正常反应消息,
    非模态调用时,COleControl中与dialog中都不响应消息.