No announcement yet.

Using Active X .ocx Controls

  • Filter
  • Time
  • Show
Clear All
new posts

    Using Active X .ocx Controls

    I need to use a library of controls from a company called Blue Marble Geographics. This library package is called GeoObjects. The controls allow maps to be displayed and 'managed' in a Windows application. They provide these controls in .ocx files and they are Active X controls.

    It's very easy to use them in VB 6 - simply add them to the Control Toolbox and they are then available to 'place' on a form and start using them.

    I've been reading the PB9 manual on using external controls and it appears that PB9 does support Active X controls in .ocx files. Is this correct?

    Using them in PB9 seems to be a bit 'complicated', but I suspect that it isn't as hard as it first looks (I hope ).

    Here's what I think I understand so far:

    First, after installing/registering the controls in Windows (that's an easy task - they're provided in an executable that I simply 'ran' and they're ready to use), it appears that I need to use the PowerBASIC Com Browser to 'create' the information needed by a PowerBASIC application to use these Active X controls. This is my first time even looking at the Com Browser - it appears that it creates an include file (that would be included into my application) which has declarations for variables and for the controls in the .ocx file (the Active X library). Is this correct?

    Again, I've read over the PB9 manual where it 'explains' using external controls, but it seems to me that it was written by someone who had a VERY good knowledge of this subject and for someone like me, it's too complicated. I need a bit more 'handholding' to figure this out.

    Any help is very much appreciated.


    Any help...please?



      I've been reading the PB9 manual on using external controls and it appears that PB9 does support Active X controls in .ocx files. Is this correct?
      Not natively. To use a visual OCXs with PB you need an OLE Container to host them.

      I have several examples in my forum that demonstrate how to do it using my OLE Container and my translation of the Windows API headers, that you must use instead of the ones provided with the compiler.

      The examples have been written using the Windows SDK style of programming, although there are a couple of them that use DDT, and there is also an article that explains how to do it using PBForms.

      The headers are available at:

      You can also find in my forum a tool called TypeLib Browser that you can use to generate the interface declarations and the classes for event sink.

      To be able to download the tools, headers and example code, you need to register in my forum using your real name (the files, provided as attachments in the posts, aren't visible unless you are a registered user).
      Last edited by José Roca; 24 Aug 2009, 10:17 PM.


        Take Jose's Advice

        Hi John!

        Jose gave you good advice above. If you really need to use visual ActiveX controls with PowerBASIC, then you need to check out Jose's work.

        Let me give you a little perspective on the issue, because I believe you might be new here. In the early 2000s when Microsoft began to dump VB6 in favor of .NET, many VB users who had used the language all through the nineties such as myself, migrated to PowerBASIC. The problem we all had was that we were accustomed to easily using ActiveX controls in our VB projects. The situation with ActiveX controls is that they are very, very, very complicated COM objects. Microsoft's Visual Basic was an incredible product that completely hid all the low level details of this extremely powerful but complex technology. At that time Jose did all the pioneering work to allow for the integration of ActiveX controls with PowerBASIC.

        What a lot of us found is that ActiveX controls had Windows Common Control substitutes. For example the MonthCalendar common control could be substituted for the MSCal.ocx ActiveX control that was widely used with VB. In other cases, such as with grids, they could be purchased seperately in the form of custom controls and these were easy to use with PowerBASIC. The up side to all this is that it eliminated dependencies which plagued VB, and the resulting speed and small program size were added benifits.

        However, in some cases the need for ActiveX integration still remained, and for that everyone (to my knowledge) followed up on Jose's work and used Jose's tools and code which he made freely available. As things stand now it is very easy indeed to use ActiveX controls with PowerBASIC, and there are countless examples over at Jose's forum. The only possible downside is that most of the code is in Sdk style. Hope this info helps.