Solved

Using an OCX without a form

Posted on 1997-03-29
3
338 Views
Last Modified: 2012-08-13
I have an OCX component included in my project (my.ocx) and under the object browser, I see the class, mMyObject listed and belonging to MyLib (lib name of my.ocx).

Now, normally I can put the control on a from very easily and set it's parameters. eg. form1.mMyObject1.UserName = "fred", or form1.mMyObject1.Action = 1

I want to be able to use the ocx/class without putting the control on a form.   I want a formless (no Interface) program, so I need to be able to access the ocx routines.

How do I do that under VB5.0 Pro?
0
Comment
Question by:mjsmith032997
3 Comments
 
LVL 1

Accepted Solution

by:
aktis earned 100 total points
ID: 1424814
You can use create object to reffer to the OCX control.
Here is a example with Internet explorer

      Dim Explorer As Object
      Explorer = CreateObject ("InternetExplorer.Application")
      Explorer.Navigate "http://www.microsoft.com"
      Explorer.Visible = True

E.g. with MapiSession Control you can write CreateObject("mapiSession")

       
0
 
LVL 1

Author Comment

by:mjsmith032997
ID: 1424815
Thanks aktis, that works fine with some controls, but the control I'm using cannot be used that way.   It will get an error on the CreateObject.   Error... ActiveX component can't create object.


0
 
LVL 2

Expert Comment

by:mflam
ID: 3050491
So why did you accept the answer?!
And what's the answer?
And... how do I get events this way?

Thanks, Moshe
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question