cancel
Showing results for 
Search instead for 
Did you mean: 

Bizarre ActiveX/OLE Control Problems

0 Kudos

So I'm just going to throw a hail mary out there is see if anybody might know what is going on here.

We have been using the DBI-Technologies Component Toolbox 5.0 within our PowerBuilder application since roughly 1999 (we started with version 4 of their components and migrated to 5).

Through this time we've moved from PowerBuilder 7, to 9, to 10.2.1 and now we are sitting on 11.5.1 Build 5097.

Yes.  These controls are old.  But they have continued to work without any issues.  Have even been able to install them on a 64bit development machine without any problem.

Now, roughly a couple weeks ago, something started happening where the windows that have the ActiveX/OLE Control on them, started throwing exceptions where it comes back and says the "object property is not available".  We've been populating the control in the constructor event.  This has always worked.  Zero issues.

Now out of nowhere.  Exceptions almost 80% of the time  (sometimes it does run correctly)

Went back into our old PowerBuilder 10.2.1 code that was running flawlessly before we did the migration.  So NOTHING had been changed in this code set at all.  Open the window.  The app crashes and gives no reason why (before exceptions were thrown into the PowerBuilder debugging environment)..

I migrated the code up to 12.1.  Same issue.

I have regenerated and optimized everything.  No matter what I do, these controls only work on an intermittent basis.  What I have found, is if I remove all the code from the constructor event, and put it in the clicked event of a command button.  Let the window open and then press the button.  Control populates with no issues.  However, if I attempt to post the clicked event from the post open of the window.  BOOM!!  Down in flames.  They (DBI) recommended that I move the constructor code to their firstdraw event.  However, what I have found is that the firstdraw event experiences an issue where it only fires correctly on an intermittent basis. And the firstdraw event does not exist in some of the controls I'm having issues with.

I'm beginning to wonder if this is something specific to my machine.  Maybe something has been changed to cause these controls to not function correctly.

Before I start blowing my machine away to see if this corrects the issue, I wanted to at least post the question and see what ideas anybody else out there might have.  This issue literally came out of nowhere.  We weren't even working in these windows.  And I opened one of them one day to look at some data for one of our users and here comes the exception.

Any thoughts on anything I might be missing would be greatly appreciated everyone!!

Thanks!!

Jeff Gibson

Nashville, TN

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jeff;

  My general advice is "Never ever and if in doubt never, use the Constructor event to initialize a control"! The reason why is that newer versions of the MS-Windows O/S and/or PowerBuilder can often change the timing and internal process order of operations during the instantiation phase of a class.

  To circumvent this, always create a PostContructor user event on any given control class and then use only the UE for initialization purposes. This gets even more critical when you move to other O/S's like Citrix or iOS/Android for example with Appeon.

   All by frameworks use the PostConstructor and have been since v1.0 - circa 1993/1994. This technique has really saved my ass over the years and PB/OS releases. I still have PB 2./3 code that migrates "as is" and runs perfectly under PB v12.6 using this approach.

Food for thought. 

Regards ... Chris.

0 Kudos

That was the first thing I did Chris.  I figured.  "OK, Windows 7 had a new update that came out.  It's changed something.  I'll post the constructor code".

Still crashes. I've attached a screen shot of the crash.

And for the record.  It throws the exception when any attribute for the control is accessed.

But great points on not putting code in Constructor events.

Former Member
0 Kudos

Oh Dear ... that's definitely not good.  

Is the FirstDraw event a POSTED event?

The fact that it works sometimes and not others is "fishy" for sure. Have you reviewed all the preamble code to ensure that the OLE connection is started properly (good return codes)?

FWIW: Another thing I like to do is wrap the OLE code in a TRY..CATCH and see of the Exception object class gives me a more definitive error code and error message that might give me a clue why the OLE interaction is failing.

0 Kudos

Yes.  The ue_first_draw() event was posted from the constructor event of the ole control.  Then I even went one level deeper and posted the ue_first_draw() event from the pfc_postopen of the window.  I figured everything had to be constructed by the point it got to there.

Got thoughts on the Try...Catch.  I'll see if I can get some more definitive information from the exception that is being thrown.

Another thing I'm going to do is test it on another development machine.  I want to make sure this is not just an issue with my laptop.

Former Member
0 Kudos

Hi Jeff;

  Good thought on trying another PC so see if its your local environment.

BTW: Have you checked with the software vendor to see if there are any issues with W10 and their product?

   I also see that the current version of the "DBI-Technologies Component Toolbox" product is 7.0. Any thoughts about upgrading?

Regards ... Chris

0 Kudos

Well...

I have now tested this issue on my desktop.  Running Windows 7 Professional 64bit (latest service pack).  My laptop is Windows 7 Ultimate 32bit.

The same error crops up on both sides.

Also....

I downloaded the latest and greatest ActiveX controls from DBI.  Moved all the code over to a test window and ran it.  Even with the newer controls.  Still ran into the same error.

Going to see what kind of information I can get from the Try, Catch.