Solved

Using an OCX without a form

Posted on 1997-03-29
3
346 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

828 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