广告合作
  • 今日头条

    今日头条

  • 百度一下

    百度一下,你就知道

  • 新浪网

    新浪网 - 提供新闻线索,重大新闻爆料

  • 搜狐

    搜狐

  • 豆瓣

    豆瓣

  • 百度贴吧

    百度贴吧——全球领先的中文社区

  • 首页 尚未审核订阅工具 订阅

    ocx 的制作和使用

    来源:网络收集  点击:  时间:2024-08-31
    【导读】:
    ocx是微软的一个老技术,但是在网页方面的用户还是蛮不错,能给客户增加直观的界面工具/原料moredelphi2010intraweb方法/步骤1/14分步阅读

    打开delphi2010,选择【file】→【new】→【other】

    2/14

    选择【activex】→【ActivexLibrary】→【OK】按钮

    3/14

    修改name为MyOcx.点击【SaveAll】按钮保存全部,保存文件名为PMyOcx.ridl。

    4/14

    选择【file】→【new】→【other】→【activex】→【Activex Form】→【OK】按钮

    5/14

    设置 coClass Name: OcxForm,再【OK】按钮

    6/14

    【file】→【Save All】保存的文件名为UOcxForm

    7/14

    现在给OcxForm 添加一个String 和Integer属性。选择PMyOcx.ridl单元。右击IOcxForm→【New】→【Property】。进入添加属性界面

    8/14

    name 改成 Myint 。Type改成Int。刷新下这个属性。同样的方法添加一个string的属性。name :MyString,Type:BSTR

    9/14

    打开UOCXFORM单元,给MyInt和MyString赋值和读取值。在private定义两个变量 MyInt,MyString。

    10/14

    function TOcxForm.Get_MyInt: SYSINT;

    begin

    Result := MyInt;

    end;

    procedure TOcxForm.Set_MyInt(Value: SYSINT);

    begin

    MyInt := Value;

    end;

    function TOcxForm.Get_MyString: WideString;

    begin

    Result := MyString;

    end;

    procedure TOcxForm.Set_MyString(const Value: WideString);

    begin

    MyString := Value;

    end;

    设置以上属性。

    11/14

    接下来就给做intraweb做准备。打开PMyOcx_TLB。找到CLASS_OcxForm: TGUID = {736D170C-B4BC-4855-AA52-E725E285FA90};保存下来。

    12/14

    选择【Run】→【Register Activex Server】,注册一下,正好在创建intraweb上使用。

    13/14

    新建一个intraweb程序。【file】→【new】→【other】→【VCL for the web】→【VCL for the web application wizard】 把project name 设置成Myocx 保存

    14/14

    在iwform1上添加一个iwactivex.在其中的IWAppFormRender事件中加入这样的代码,就可以向里面传参数了。

    procedure TIWForm1.IWAppFormRender(Sender: TObject);

    var

    Myint: Integer;

    MyString: string;

    begin

    Myint :=8888;

    MyString := 8888;

    IWActiveX1.ClassID :=clsid:736D170C-B4BC-4855-AA52-E725E285FA90;

    IWActiveX1.CodeBase :=http://192.168.0.56:8888+/files/PMyOcx.ocx#version=1,0,2,1;

    with IWActiveX1.Params.add do

    begin

    Name :=Myint;

    Value := IntToStr(Myint);

    end;

    with IWActiveX1.Params.add do

    begin

    Name :=MyString;

    Value := MyString;

    end;

    end;

    制作
    本文关键词:

    版权声明:

    1、本文系转载,版权归原作者所有,旨在传递信息,不代表看本站的观点和立场。

    2、本站仅提供信息发布平台,不承担相关法律责任。

    3、若侵犯您的版权或隐私,请联系本站管理员删除。

    4、文章链接:http://www.1haoku.cn/art_1175258.html

    相关资讯

    ©2019-2020 http://www.1haoku.cn/ 国ICP备20009186号05-06 14:52:04  耗时:0.027
    0.0274s