Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function declarations...

Status
Not open for further replies.

elziko

Programmer
Nov 7, 2000
486
GB
I have an OCX which contains a class module. In this module there if a funtion VersionInfo() which returns a single string and expects no arguments.

In another project if I set a reference to this object then I ham able to do this:

Dim e As InfoPDL (which obviously is the name of the class)

however when I do this:

Set e = New.... then InfoPDL is not available in the "Auto List Members" list.

So instead I decided to try this:

Private Declare Function ChartVersionInfo Lib "D:\Projects_JE\E2301\Report Creator\PDL_Chart.ocx" Alias "VersionInfo" () As String

But I am told that Can't find DLL entry point VersionInfo..... Can I not declare a funtion like this form an OCX file?

Can anyone help with either method?

Many thanks

elziko
 
Is InfoPDL a class or a control? If it is a class is it public?

If it is a control then you cannot use New to instantiate it. You can add one to your form using Controls.Add (you will need to set the Visible property to True to actually see the control - it is False by default.

Also, if VersionInfo sounds like a good candidate for a Property as opposed to a function. You need to ensure that it is Public Read though. If you want to keep it as a function then ensure that the function is public.

Chaz
 
Well, my OCX is compiled from a project that contains a control and a class. InfoPDL IS a class and is set "Public Not Creatable". Is that right?

I suppose it could be done as a property but to bring it in line with the rest of the app I'd still like to keep it as a function.

I still can't get it to work!

Cheers,

elziko
 
Aha - If it is Public Not Creatable then you cannot create it - so that explains your New problem.

Try changing it to MultiUse.

Chaz
 
Doh!

Now I see. Why would anyone want a class that you can't create an instance of?? Just wondering.

Thanks a lot,


elziko
 
Other applications can use objects of a Public Non Creatable Class only if your component creates the objects first. That means that the other applications cannot use CreateObject or the New operator _________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top