Newbie With ActiveX Issues

I’ve been searching the forums and googling like crazy but can’t get my OCX/ActiveX controls to work.

The controls are built using VS2005. I’m on RS 2012r2.1 Ent. Edition (if this matters).

I’m able to add my controls in the Project pane, Add ActiveX Component. These are treated as an OLEContainer.
I can see them in the control list when I create an empty form/window. I am able to place these on the window.
How ever when I run in debug mode nothing happens - the window does not appear (my MsgBox in the window’s
Open event never appears and break points in Open aren’t hit like me.Show).

I’ve been trying only 1 or 2 controls. When I remove these from the window I can debug just fine, break points are hit.
When I click on a control from the project pane I can see (in another pane) the methods, properties, shared methods etc and
when I expand these everything I expect to see is there.

With none of my controls on the window, I’ve been able to, in the windows Open method:
Dim myOcx As OLEObject
myOcx = new OLEObject( “{GUID…}” )

Dim path As String
path = myOcx.Invoke( “GetPath” ) <== OLEException, failed on “GetPath”

Questions:
Is there a way to use the debugger to “see” what is going on? See what’s preventing the window from being launched?

Is there another alternative for using controls w/o putting them on a form/window?

Thanks for any help suggestions.

Dave

It might be hitting an Exception in code that cannot be shown. Try disabling BreakOnExceptions or hitting Resume, sometimes that will clear it enough.

Thanks for the reply.

I tried disabling BreakOnExceptions but no luck. Since I’m only looking at the Open event I assume that’s
where it should go. Unfortunately hitting the Resume button does not clear the problem (been
hitting Resume many times without any change).

An alternative is to add an OLEContainer to your window, right-click on it and select your ActiveX component from the list. This approach avoids us generating any initialization code that may be causing issues, then you can access the Content property of the OLEContainer which returns an OLEObject that you use to automate the control.

William,

Thanks for the suggestion. So far so good.

Dave

I am also new to XOJO and plan to use it to migrate a fairly large VB6 app. Although I may try to avoid using ActiveX controls it would still be good to know it can be done if I determine I still need it somewhere.

This might be a newbie question but how do I add an OLE Container to a Window? When I right click and try to Add to the Window, the option to choose Container Control is disabled. I can insert a Container Control to the project, but when I right click and try to Add to the Container Control then the option to choose ActiveX is disabled.

Thanks!! Looking forward to learning and using XOJO.

To add an OLE Container to a window, drag it from the Library onto a Window Layout. You can specify the ProgramID in the Inspector or right-click and select “Choose ActiveX Control”.

More info is in User Guide Book 4: Development, Chapter 2: Cross-Platform Development, Section 4: Windows Features, 4.1: OLE.

Thanks for the prompt response Paul, although unfortunately I am still a bit stuck. Should the OLE container appear by itself in the Library? I don’t see that in my Library pane although I do see a Container Control but don’t know how to define that as an OLE container.

I did User Guide read chapters 2 and 4 - very informative and might have answered my question on how to migrate my MS Access database with this project.

OLE Container is definitely in the Library. I see it in my list under Movie Player. It looks like a LEGO brick. The easiest way to find it is to just type “OLE” in the Library search field. The Container Control is something completely different and not related.

Indeed it is - must be time for my eye exam. :slight_smile:

I was able to add the OLE Container to a Window but when I right click on the container the option to add ActiveX Control was disabled.
But I actually got it to work by using the Insert function and choosing ActiveX Control. It seemed to matter that I chose the Reference first and then the Control.

Good to know that I can use ActiveX but it seems to negate some of the reasoning for using XOJO if I rely on ActiveX, although there might be a couple of places where it will expedite my migration.

Thanks again for the prompt responses.

This is definitely true. You probably ought to see if you can find an equivalent Xojo cross-platform replacement.

Be sure to check out the 3rd party product page on the wiki:

http://documentation.xojo.com/index.php/Third_Party_Products