1. Fabio Pontel
  2. PowerBuilder
  3. Thursday, 10 October 2024 13:05 PM UTC

I have the same source code in pb10.5 and pb2022, both compiled in 32-bit.

In pb105, using the command CONNECTTONEWOBJECT("classolecomNONONONO") works.

However, in pb2022 it always returns -3.

What is the cause? How can I solve it?

Accepted Answer
Fabio Pontel Accepted Answer Pending Moderation
  1. Friday, 18 October 2024 16:46 PM UTC
  2. PowerBuilder
  3. # Permalink

Partially solved!

How? Generating the executable in PowerBuilder 2022 and running it through the generated executable works.

Unfortunately, I have come to the conclusion that the problem is certainly in the PB2022 IDE.

However, if I need to debug it, I won't be able to. Because it doesn't work through the IDE (it always returns -3).

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 10 October 2024 15:00 PM UTC
  2. PowerBuilder
  3. # 1

Hi Fabio;

  The -3 means "Object could not be created" and is probably because the OLE Server is not available or the OLE processing in the O/S cannot locate it.

  Note that OLE services are handled by the O/S and not PB. The O/S uses the Registry to locate the App by it's Service Name in the registry. So this type of failure could mean that the OLE server is not registered properly.

  Are you testing the OLE feature on the same machine where PB 10.5 is also located?

Regards .. Chris

Comment
  1. Fabio Pontel
  2. Thursday, 10 October 2024 18:52 PM UTC
Yes, same machine. Same dll/ole/library.
  1. Helpful
There are no comments made yet.
Fabio Pontel Accepted Answer Pending Moderation
  1. Thursday, 10 October 2024 16:44 PM UTC
  2. PowerBuilder
  3. # 2

Yes, same machine. Same dll/ole/library.

 

 

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 10 October 2024 17:16 PM UTC
In that case, it could be due to the build that you are using...

Is your PB 2022 the R3 release build 3391?
  1. Helpful
  1. Fabio Pontel
  2. Thursday, 10 October 2024 18:34 PM UTC
in 2022 R3 3391 and 3356
  1. Helpful 1
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Thursday, 10 October 2024 16:58 PM UTC
  2. PowerBuilder
  3. # 3

When you start the PB app, did you select Run as Administrator option.  The PB app might not have the privileges to access the registry and/or DLLs.

Comment
  1. Fabio Pontel
  2. Thursday, 10 October 2024 18:37 PM UTC
Both pb105 and pb2022 are running as administrator.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 10 October 2024 19:15 PM UTC
  2. PowerBuilder
  3. # 4

Hi, Fabio -

What OLE Server/COM object are you connecting to? Is it available to be downloaded and installed so that I could test, or is it a purchased/licensed product?

What workstation hardware and OS are you running PB 2022 R3 on?

Comment
  1. Fabio Pontel
  2. Friday, 11 October 2024 12:11 PM UTC
Registering using regsvr32 as documented at: https://learn.microsoft.com/en-us/dotnet/core/native-interop/expose-components-to-com#register-the-com-host-for-com in the topic "Register the COM Host for COM"
  1. Helpful
  1. John Fauss
  2. Saturday, 12 October 2024 14:13 PM UTC
Like it does for Ken, registering the dll fails for me.
  1. Helpful
  1. Fabio Pontel
  2. Monday, 14 October 2024 11:25 AM UTC
For the registry to work (regsvr32) you need to have the dotnet core 6.0 runtimes



For List Runtimes in (CMD) Command line: "dotnet --list-runtimes"



Result OK:

Microsoft.NETCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Microsoft.WindowsDesktop.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

  1. Helpful
There are no comments made yet.
Fabio Pontel Accepted Answer Pending Moderation
  1. Thursday, 10 October 2024 19:44 PM UTC
  2. PowerBuilder
  3. # 5

attached dll/ole used in testing on this forum

Attachments (1)
Comment
  1. Fabio Pontel
  2. Thursday, 10 October 2024 20:13 PM UTC
This dll is mine. I created it. And it is already working on pb105.

It was developed in net core 6.0. (using this support link to develop: https://learn.microsoft.com/en-us/dotnet/core/native-interop/expose-components-to-com )
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 10 October 2024 21:22 PM UTC
Ahhh ... I thought as much. PB 10.x releases were compiled using VC++2010 whereas PB 2022 uses VC++2019 and PB 2022R3 (higher) uses VC++ 2022 Microsoft compiler. So I suspect (my guess ATM) is that the issue is related to differences in the "C" compilers being used.
  1. Helpful
  1. Fabio Pontel
  2. Friday, 11 October 2024 10:50 AM UTC
This doesn't make much sense. Because I did a test using the same project and recompiling it in 64 bits in Visual Studio. And with this dll recompiled in 64 bits in Pb2022 also in 64 bits it works.



So why does a 32-bit library that works in pb10.5 not work in pb2022 in 32 bits? But the same library compiled in 64 bits works in pb2022 in 64 bits.



I need it to work in pb2022 in 32 bits. I can't upgrade my legacy code to 64 bits at this time.
  1. Helpful
There are no comments made yet.
Ken Guo @Appeon Accepted Answer Pending Moderation
  1. Saturday, 12 October 2024 09:10 AM UTC
  2. PowerBuilder
  3. # 6

Hi Fabio,

I suggest you submit a bug to Appeon Support System at https://www.appeon.com/standardsupport/newbug so that we can better analyze this problem. When you submit the bug, please:
1. Please input the specific PB version you are using.
2. Please provide all the DLLs that would be used by OLE. Because I’ve tried REGSVR32 registering the DLL you provide in Community but failed.
3. Please provide a small case that can reproduce this problem and it would be better if you can also provide a case that works fine in PB 10.5. I would like to upgrade it version by version to check each PB version so that we can find out in which PB version the problem started.


Regards,
Ken

Comment
There are no comments made yet.
Fabio Pontel Accepted Answer Pending Moderation
  1. Thursday, 17 October 2024 18:12 PM UTC
  2. PowerBuilder
  3. # 7

For the registry to work (regsvr32) you need to have the dotnet core 6.0 runtimes



For List Runtimes in (CMD) Command line: "dotnet --list-runtimes"



Result OK:

Microsoft.NETCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Microsoft.WindowsDesktop.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.