位置于:书籍教程首页>>数据库类>>Power Builder>>正文

PowerBuilder 使用 (2)

http://www.xp163.com/制作:

在PowerBuilder中使用 OLE Automation

  PB5 不仅可以支持OLE Automation Client, 而且可以很方便地做OLE Automation Server. 事实上,每个user object 都是OA Enabled的。

如果外面的应用程序要使用PB的User Object, 只需作如下调用:

1. 在VB中调用

    Dim PBObject as object

    'Create the ole object at first

    PBObject = CreateObject("uo_test") 'uo_test is my userobject in PB

    if PBObject is nothing then

     REM Error handling

    else

     PBObject.SomeAttribute = "some value"

     PBObject.DoSomething("Method parameter")

    end if

    'Disconnect the OLE object

    PBObject = nothing

2. 在PB中使用其它PB程序的对象

    OleObject PBObject

    long status

    PBObject = CREATE OleObject

    status = PBObject.ConnectToNewObject("uo_test")

    if (status<0) then

     // Error handling

    else

     PBObject.SomeAttribute = "some value"

     PBObject.DoSomething("Method parameter")

    end if

    // Destroy the object after quiting program

    DESTROY PBObject

  当然,如果要向上面如此方便地使用PB的user object, 使其在外部可被驱动,必须在系统的注册数据库中有记录。利用PB5提供的Install Builder, 可以方便地生成注册所需要的注册数据和Type Library.


 最新网站更新
 网站PowerBuilder 使用 (2)说明

 

 书籍教程站内推荐信息
 书籍教程网站地图