Skip to Content
avatar image
Former Member

Bizarre ActiveX/OLE Control Problems

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Oct 27, 2015 at 11:48 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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.