We have couple of existing PB applications in version PB12.5.2 which are of .NET win forms target.
We noticed that this target is no longer available in PowerBuilder 2017 R3.
What is the workaround to migrate these applications to the new version. We need this application as a .NET target since we are referencing a COM Visible .NET DLL to call the methods inside the DLL.
We also tried to use the appeon_workaround.pbl but it is not returning back the result from the DLL method. The code looks like below. We also deployed the application and tried to run from the EXE. It didn’t work either. The return argument – iResult is NULL. There is no error however when we call the function.
Appreciate if you could address this and let us know how we can migrate this application to the new version.
long lRet
string iResult
string strError
string ls_cipher_string = ‘TEST’
appeondotnetcomponent comcaller
any paramlist[]
comcaller = create appeondotnetcomponent
comcaller.componenttype = '1'
comcaller.typelib = 'HelloWorld.dll'
comcaller.classdescript = 'Program'
// invoke component method
paramlist[1] = ls_cipher_string
lRet = comcaller.of_execinterface( "SayHello", paramlist)
if lRet = 0 then
iResult = string(comcaller.ReturnValue)
messagebox('Hi', iResult)
else
strError = comcaller.ErrorText
end if
Unfortunately, the article was migrated from my wordpress blog to blogger, and I didn't realize that it was still referencing the images in wordpress until I took the wordpress site down, so all the images were lost.
There should be similar content on the old PBDJ site, but I can't find it readily.
C# DLL Code:
namespace HelloWorld
{
[ComVisible(true)]
public class Program
{
[ComVisible(true)]
public static string SayHello(string name)
{
return $"Hello - {name}";
}
}
}
I have given it a strong name. Then I added it to GAC using GACUTIL. After that I have created a .reg file using REGASM and also ran the REG file to add to registry.
PB Code:
integer li_rc
string ls_result
oleobject loo_test
loo_test = CREATE oleobject
li_rc = loo_test.ConnectToNewObject ( "HelloWorld.Program" )
ls_result = loo_test.SayHello('Praveen')
Destroy loo_test
==================================
When I ran this I am getting an error saying - "Name not found calling external object function sayhello"
The OLE object is getting created fine, but the method call is the problem.
What is it that I am missing here?
Thanks
Praveen