[PB] Create and call COM in pb9

Source: Internet
Author: User

Creation method:

1. Create a workspace

2. Create an application under workspace (assuming the name is myapp)

3. Create a custom class,

You can create a function in custom class.

4. Create a project

Select COM/MTS/COM + Component Wizard

Enter the Project name

Select a custom class

Set Interface Name

Set Program ID string

The default value is PB90. [custom class name]. We can modify it. (assume that it is changed to PB90.cus _ class7. This name is the class name called in pb)

Set Com Class Name

The default value is coclass _ [custom class name] (assuming coclass_cus_class7, this name is the class name called in VB)

Select register components upon successful build

5. generate DLL

Select the newly created Project, right-click, and click deploy

This completes the creation of COM.

 Call method:

1. in VB

Create a VB project and add reference pb90 generated typelib for: MyApp. dll

Note that the red part is the output DLL file name, which is generally the same as the application name.

Write code:

As new myapp. COClass_cus_class7
MsgBox a. dog

Apparently, this COM is used through [Application name]. [com classname.

2, in Pb

Int intValue
Oleobject objOle
ObjOle = create OLEObject
IntValue = objOle. connecttonewobject ("PB90.cus _ class7 ")
If intValue = 0 then
String v
V = objOle. dog ()
Messagebox ("ss", v)

Apparently, this COM is used through [program id string.

Tests show that the calling methods in VB and Pb are different.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.