?
Solved

Using an OCX without a form

Posted on 1997-03-29
3
Medium Priority
?
370 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
aktis earned 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

800 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