Solved

Using an OCX without a form

Posted on 1997-03-29
3
323 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now