1. Sivaprakash BKR
  2. PowerBuilder
  3. Wednesday, 16 August 2023 08:08 AM UTC

Hello,

Using Powerbuilder 2022 R2 2819, Chilkat-9-5-0, Windows 10 Pro 64 bit, nssm

In normal client/server application, I could use Chilkat, and unlock it using  loo_Glob.ConnectToNewObject("Chilkat_9_5_0.Global"). No issues.

When I try to use the same way to connect this ActiveX from a windows service application, it fails. 

The App is developed using PB 2022 R2.  Installed as a service in the same machine.
Chilkat installed in the same machine using the batch file provided.  Since the app is 32 bit, I installed the activex using the register_x64.bat.   Since it failed, I tried with register_win32.bat.  Both failed.  I used nssm to install and run the service application.

I registered the activex using register_x64.bat. Registration succeeded.  I verified it running the client/server application.  But the windows service application fails to unlock the bundle.  

Then I unregistered the 64bit version, registered with register_win32.bat file.  Registration succeeded.  Here also the windows service application failed to unlock the bundle.  

IS it possible to access a third party ActiveX from a windows service in the same way that we used to access the ActiveX in a client/server application?

Or Am I missing something?

Happiness Always
BKR Sivaprakash

 

Sivaprakash BKR Accepted Answer Pending Moderation
  1. Wednesday, 16 August 2023 11:24 AM UTC
  2. PowerBuilder
  3. # 1

Thanks Andreas.

Found the issue.   Actually when I tried to run the batch file in Administrator mode, it got executed with no error message. With no error message, I thought the registration has succeeded, seems that's not the case.
Then I typed out the contents of the batch file in the DOS prompt, as an administrator, it got registered and everything is working fine.  

Don't understand why the batch file didn't successfully register the activeX?   

And for your further information.
Chilkat got an unlock bundle command to be executed first, before calling any other methods.  That has to be executed with the command,

li_rc = loo_Glob.ConnectToNewObject("Chilkat_9_5_0.Global")

It failed in windows service application and returned -1.

Thanks once again for your time and suggestions.

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Wednesday, 16 August 2023 11:01 AM UTC
  2. PowerBuilder
  3. # 2

Hi.

You mention:

But the windows service application fails to unlock the bundle.

Can you be more specific at this point? What does mean "fails to unlock the bundle"?

While I never tried to use an active-x inside a service, I have used com objects inside a service. The service was created in c#... At the time I used a com object (providing some sync functionality for ftp), and a PB.NET assembly used to process data received from ftp. Active-x and com isn't the same but have similarities so I guess it should work. I remember that after some upgrade I had issues with the com object I was using, and I had to change some settings using mmc and it's component services snap-in. Also, my service was running under a specific user and this may be an important point.

If your active-x doesn't use gui, it should work. Actually, since you are using nssm to create your service, your pb exe has nothing specific or different than when executed as a normal executable. What changes is the environment where it's called, and the fact that a service won't show you any information (windows, messagebox's etc). That said, you should implement good error handling and logging to be able to see what's happening.

Andreas.

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Wednesday, 16 August 2023 08:51 AM UTC
  2. PowerBuilder
  3. # 3

Hi.

Generally speaking it should work. But, why register_x??.bat files do fail? Maybe you should execute them with elevated privileges?

Andreas.

Comment
  1. Sivaprakash BKR
  2. Wednesday, 16 August 2023 09:59 AM UTC
Thanks Andreas.

I don't think register_x fails. ActiveX installed with register_x, works find in client/server application. But the windows service app, couldn't find the same activeX.

Nevertheless I tried installing the activeX in Administrative mode. No luck.
  1. Helpful
  1. Andreas Mykonios
  2. Wednesday, 16 August 2023 10:21 AM UTC
Sorry. I'm confused. In your original question you mention:

"Since the app is 32 bit, I installed the activex using the register_x64.bat. Since it failed, I tried with register_win32.bat. Both failed."

Based on the above statement I thought that registration failed... Anyway why did you first tried to use x64 register batch file? Also what user is running your service?

Andreas.
  1. Helpful
  1. Sivaprakash BKR
  2. Wednesday, 16 August 2023 10:36 AM UTC
Sorry Andreas. I'll correct that part of my original post.

Actually registration succeeds. It fails when I tried to unlock the bundle in the service application.
  1. Helpful
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.