不可以用HTML参数!最好是本功能包含在该ActiveForm内!

解决方案 »

  1.   

    我也想知道啊!MS的 XMLDocument 控件可以传类似"./aaa/bbb.asp"这样的URL,
    但我自己写的ocx(内部自己建http连接)则必须要传"http://xxxxxxxx/aaa/bbb.asp"郁闷!
      

  2.   

    sorry, 我一时也没有什么想法
      

  3.   

    lya_lya(元元)
    那样不是很完美呀!
    555555555555555
      

  4.   

    function TActFrm.GetOwnerUrl:string;
    var
      site: IOleClientSite;
      sp: IServiceProvider;
      hr: HResult;
      temp_URL : string;
      shttp : string;
      i : integer;
    begin  // This code obtains the automation interface of the web browser
      // that the ActiveForm is embedded into, and uses it to
      // get the current web address, LocationURL.
      shttp := 'http://';
      if (ComObject as IOleObject).GetClientSite(site) = S_OK then
        if site <> nil then
          begin
            hr := site.QueryInterface( IServiceProvider, sp );
            hr := sp.QueryService(  IWebBrowserApp, IWebBrowserApp, browser );
            temp_URL := browser.LocationURL;
            if LowerCase (Copy (temp_URL, 1, Length (shttp))) = LowerCase (shttp) then
              Delete (temp_URL, 1, Length (shttp));
            i := pos('/',temp_URL);
            if i =0 then
              Result := temp_URL
            else
              Result := copy(temp_URL, 1, i-1);
          end;
    end;注意:这个函数好象必须在CREATE完成之后运行
      

  5.   

    我有更简单的方法:use mshtml....function ......var
      r , ht, pn , u : String;
      i_hd : IHTMLDocument2;
      i_oc : IOleContainer;
      i_ow : IOleWindow;
    begin
        if (ActiveFormControl.ClientSite.GetContainer(i_oc) = S_OK) and
           (i_oc.QueryInterface(IOleWindow, i_ow) = S_OK) and
           (i_ow.QueryInterface(IHTMLDocument2, i_hd) = S_OK) then
        begin
          ht := String(i_hd.location.protocol+'//'+i_hd.location.host);
          pn := String(i_hd.location.pathname);
        end
    ...//可以参照一下javascript,i_hd 就是 javascript的window.document
      

  6.   

    myy()的方法确实非常牛呀,给吓到了,呵呵俺介绍一种相对较容易的方法吧,呵呵
    在你写ActiveForm时,在工程的Type Library里相应的Interface对象下面添加一个(写入)属性。(这是在开发OCX时做的事,下面是在写脚本或是ASP时用的)在脚本里写入
    document.all.<组件在网页里的实列名>.<刚刚设的属性> = Request或是别的方法取得URL这样子就OK了,在ActiveForm里声明一个私有变量,然后接受写入的属性,就可以在ActivForm里随意使用了,呵呵其实这种方法跟myy()的方法有异什么什么同工之妙,呵呵。都是用了接口来干事的。
    myy()用的是IE本身的接口来取得URL,而这边用的是自己声明接口来传入URL。
      

  7.   

    在接口定义中( Type Liabrary ) 中定义一个方法,然后在脚本调用接口方法从而把参数传进去。例如: 我在接口 IMy 上定义了一个方法 SetName( strName : WideString ) 然后用脚本调用 :
      document.all.myobj.setname( "wang")
    其中,myobj是
    <object
       ID =  "myobj"
    >
      

  8.   

    借楼主宝地问一下楼上,如可才能得myojb在delphi中