ActiveX without using a .ocx file

From: Alastair Anderson (alastair_anderson_at_hotmail.com)
Date: 01/19/05


Date: 19 Jan 2005 08:07:02 -0800

Short Question:
---------------
Can I use ActiveX from Delphi on an application which claims to use
ActiveX but has no .ocx file? If so do I use the .dll files or the
.exe?

I haven't used ActiveX before, so all this is totally new to me.

Long Question (to put this in to some context on why I am asking
this):
-----------------------------------------------------------------------

I have been handed a task of writing a piece of label printing
application which interacts with another piece of software called
BarTender to generate the labels from templates.

In the application's help files (segment placed below) it shows an
example of how to do it using visual basic.

I haven't used ActiveX before and having investigated it from the
Delphi side it refers to using a .ocx file which doesn't exist for
this application. It does have an exe and some dll files:

bartend.exe
BtEng.dll
BtPvDt6.dll
cneng.dll
Imgman32.dll
RoboEx32.dll

(I understand ppl reading this might not know what thy mean, but
because I am unsure of dll file naming conventions you may or may not
be able to have a rough guess at if they are needed.)

As far as what I can tell from my limited experience in this, is that
a reference to the bartender application (not sure if it is the exe or
any of the dll's) is being set up in the IDE (through a prompt or
dialog box) and from there-after you can call and use the various
methods and properties that are provided by the bartender application

Any help regarding this would be mucho appreciated as I have been
tearing my hair out for hours now, and I think it is going to be as
simple as "yeah, this is how you do it..." or "no!!!, don't be so
stupid".

HELP FILE SEGMENT
-----------------------------------------------------------------------------
To access the Application object from Visual Basic (or any program
that supports automation), you must perform the following steps.

1. Set a reference to BarTender application.

This can be done from Visual Basic by selecting References from the
Project menu, and selecting BarTender 6.0 library from the Available
References list box. If you are using Visual Basic for Applications
(i.e. supported by Microsoft Office Suite and other programs), the
References dialog can be found in the Tools menu.
-----------------------------------------------------------------------------
2. Declare an object variable of type BarTender.Application using the
Dim command.
-----------------------------------------------------------------------------
3. Start a new or access a running BarTender application by returning
a reference to BarTender Application object and setting it to the
object variable defined in the step above.
----------------------------------------------------------------------------
4. Quit BarTender application using the Quit method of the
Application object.

For example, the following Visual Basic code will start a new copy of
BarTender and quit.

   Dim btApp As BarTender.Application
   Set btApp = CreateObject("BarTender.Application")
   btApp.Quit

If you would like to reference a BarTender application that is already
running then use the GetObject function in place of the CreateObject
function.
You can also declare the Application variable to be of type Object.
However, be careful when using the Object type because it will run
slower. Try always to declare an object variable using its respected
type. You will run faster and will be able to use Visual Basic's
IntelliSense technology.
-----------------------------------------------------------------------------



Relevant Pages

  • Re: Access 2.0 and VB
    ... Tools/References. ... Your reference should be set. ... it's probably means that your Bartender is not installed properly or is not ... "Mark" wrote in message ...
    (microsoft.public.access.modulesdaovba)
  • Re: Late Binding
    ... I tried to recompile without an ActiveX reference and it didn't work. ... It will compile with ActiveX 2.1 (although I haven't checked functuionality ... Doug Steele, Microsoft Access MVP ...
    (microsoft.public.access.queries)
  • Re: vba select from Active Directory (LDAP)
    ... I'm just taking a guess here, but maybe you have to add a reference to the ... Microsoft ADO file under the Visual Basic ... Microsoft ActiveX Data Objects Recordset in there as well, ...
    (microsoft.public.excel.programming)
  • Re: noob class question
    ... libraries, executables, or ActiveX controls. ... you should reference it as you normally do with one exception - you ... Add new project, of type ActiveX Dll, to the group: ... Project->Select ActiveX Dll as a project type - again no code needed. ...
    (microsoft.public.vb.general.discussion)
  • Re: ActiveX EXE question
    ... "Saga" wrote in message ... > dialog of the project that calls the ActiveX to respecify the reference. ... compatibility option settings. ...
    (microsoft.public.vb.general.discussion)