I am looking for direction in regards to calling a C# module (written in the .NET (2.1) framework) from PowerBuilder. Here is the C#.NET information: The function is used to connect to COM PORT device and get the device status.
NameSpace: NETS
Class: NETS
Method: REQUESTCARDSTATUS()
DLL: NETS.dll
Using my dll as OLE Object in Powerbuilder. I am using PowerBuilder version 11.5. I have a simple window with a command button on it. Within this window, my code looks like this:
OLEObject ole_3
ole_3 = CREATE OLEObject
// connect to C# class
MessageBox("Value = ", +String(li_rc))
IF li_rc <> 0 THEN
DESTROY ole_3
END IF
li_sum = ole_3.RequestCardStatus();
Getting error while calling this function Error R0035: Error Calling External Function.
The function is working fine when try to call the function using c# application. I don't know what is causing the issue in powerbuilder. Trying from past three day, but no luck.
Your code shows that you have not called the ConnectToNewObject function for starting the Ole server application. After creating ole_3 and before calling the RequestCardStatus function, you should call this function as follows:
ole_3.ConnectToNewObject ( classname )
where classname is a Progid or a Classid of the server
The C# dll must be made COM visible.
The syntax to connect (using your example) would be: ole_3.ConnectToNewObject('NETS.NETS')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.