我用Vc++ MFC 编写的ActiveX控件,用调试器调试正确,也可以插入到窗体容器中.但为什么插入到Word文档中会出错?先是Word自动关闭,重建了同名控件后,插入时提示"应用程序不能用来打开此对象...".这是什么原因呢?要编写能插入到word文档中的控件,需要做什么?

解决方案 »

  1.   

    注意design mode 和 user mode.
    WORD加载控件的时候是design mode.
      

  2.   

    word里是windowless的,控件不是一个窗口,看看有没有用到窗口句柄的
      

  3.   

    是不是跟word的安全机制有关呢,word要求控件必须是已经被标记为初始化安全的,否则在word中加载此控件时会提示是否打开.类似于宏
      

  4.   

    Some controls produce an error message if you attempt to run them. Word displays the following error message: "The server application, source file, or item cannot be found. Make sure the application is properly installed, and that it has not been deleted, moved, or renamed." Actually, the problem isn't that the control cannot be found or isn't registered; it's just that Word doesn't recognize it.http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnarword97/html/wdactivewd.asp