好久没来, 有一问题要向高手请教如何在自己的Browser程序中截获html window.showModalDialog()? 我想要在自己的Dialog中显示html而不是用IE提供的那个对话框msdn的那几篇关于IHostDialogHelper的文章, 那里没有提到如何实现自己的IHostDialogHelper, 只是说了如何通过IHostDialogHelper调用IE内部的对话框我已经尝试过让ControlSite实现IHostDialogHelper, 并且在IServiceProvider.QueryService提供这个接口, 但是不管用另外, 不要告诉我用API hook...

解决方案 »

  1.   

    Not officially possible prior to Windows XP SP2 and Windows 2003 SP1. see NWMF_HTMLDIALOG in MSDN documentation for more information.
     
    However, you may "set" the "showModalDialog" property of the window object to a custom function in order to override the default behavior after the Document Object Modal (DOM) is available. The DOM is available between the DocumentComplete event and the BeforeNavigate2 event of the top level browser object
      

  2.   

    谢了, 应该让controlSite实现INewWindowManager就可以了吧
      

  3.   

    重载showModalDialog也是另外一个思路, 在JavaScript里面我会, 但是在vc里面, 应该传什么样的东西给PutProperty()? 一个IDispatch吗?另外,怎么结分, 不会... 管理界面里已经有200了, 但是帖子打开还是0分, 不知道为何
      

  4.   

    window.showModalDialog = function(sURL, vArguments, sFeatures)
      

  5.   

    >  window.showModalDialog = function(sURL, vArguments, sFeatures)这个是JavaScript的实现吧, 如果在vc里面怎么定义一个javascript funciton啊, 应该是类似IDispatch之类的接口吧?  我想了一下, 这样应该可以:p_ihtmlwindow->execScript("window.showModalDialog=function myshowmodaldialog(sURL, vArguments, sFeatures){ window.external.mycallback.showMyDialog(sURL, vArguments, sFeatures);}", &result);我要实现external object
      

  6.   

    INewWindowManager是用来控制是否弹出窗口, 也就是安全控制, 并不能指定替代窗口