Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can VFP call Powerbuilder COM objects?
Message
From
18/07/2006 15:09:23
 
 
To
18/07/2006 11:44:00
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
01137267
Message ID:
01137355
Views:
65
This message has been marked as the solution to the initial question of the thread.
After fiddling around I finally got it to work in VFP. I went through the Windows Registry and noted that the PB dll was registered as PB105.pbcom_functions. NOTE that this is not the same as the name shown in VFP Object Browser and how it is accessed in .Net. Using the registered name from the VFP command window will allow you to consume the DLL without problem. Hope this will help someone in the future.
ox = createobject('pb105.pbcom_functions')
?ox.simple_multiplier(2,2) && prints 4
>Hi all,
>Can VFP call Powerbuilder COM objects? This is probably my longest thread yet, please read thru. Any feedbacks/comments/anything welcome.
>
>Let's assume that I have a PBCOM.DLL containing the classID of "COCLass_pbcom_functions" which contains a simple function called: "simple_multiplier(arg1 int, arg2 int)" which returns the Product of the two parameters.
>
>I've tried the following:
>1. This works in VB.Net (Windows application); I have a form with a button with the following code on the click event:
>
>Dim cls As New pbcom.COClass_pbcom_functions
>MsgBox(cls.simple_multiplier(2, 2))
>
>
>2. This works in VB.Net (Console application); I have the following code in the Main method:
>
>Dim cls As New pbcom.COClass_pbcom_functions
>Console.WriteLine(cls.simple_multiplier(2, 2).ToString())
>Console.Read()
>
>
>3. Similar code works in C#.Net (Windows)
>
>4. Similar code DOES NOT WORK in C#.Net (Console)
>
>5. In VFP 8; I can see the object in the Object browser but this code snippet does not work:
>
>ox = createobject("pbcom.COClass_pbcom_functions")
>* Error message: Class definition pbcom.COClass_pbcom_functions is not found.
>
>
>6. I tried using the INTERFACE option but the function always returns .T.
>
>x=NEWOBJECT("myclass")
>?x.Ipbcom_functions_simple_multiplier(2,2)
>
>DEFINE CLASS myclass AS session OLEPUBLIC
>   IMPLEMENTS Ipbcom_functions IN "d:\test\powerbuilder\test01\pbcom.dll" && "pbcom.COClass_pbcom_functions"
>   PROCEDURE Ipbcom_functions_simple_multiplier(arg1 AS INTEGER, arg2 AS INTEGER) AS INTEGER
>   * add user code here
>      return dodefault(arg1,arg2)
>   ENDPROC
>ENDDEFINE
>
ramil
~~ learning to stand still
Previous
Reply
Map
View

Click here to load this message in the networking platform