Solved

Mystery Class Module purpose?

Posted on 2006-07-24
6
583 Views
Last Modified: 2008-02-01
I have a VB6 application that is several years old, and has been running fine. I had a subcontract coder help me with the coding years ago.

Now, I am editing the code, and find (what I think is) a Class Module, named Application (saved as Application.cls). I do not understand its purpose or operation. I can comment out the code, and the application seems to still run fine, but, if I remove the cls module, I get an error:

"No creatable public component detected. Press F1 for more information."

The VB6 help then says "ActiveX EXE, ActiveX DLL, and ActiveX Control project types require that you have a least one public creatable class module."

The code in Application.cls looks like this:

***********************************
Option Explicit
Private frm As New frmMain
Public hWnd As Long

Private Sub Class_Initialize()
'    frm.Show
    hWnd = frmMain.hWnd
End Sub


Private Sub Class_Terminate()
'    Unload frm
'    Set frm = Nothing
End Sub
***********************************

What does this code do, and how is it invoked?
0
Comment
Question by:lee88
  • 3
  • 3
6 Comments
 

Author Comment

by:lee88
ID: 17167065
I just noticed that the project type is set as "ActiveX EXE" instead of "Standard EXE". This application runs as a desktop application. What does "ActiveX EXE" project type mean?
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 17167079
ActiveX Exe means that the application can run standalone AND also can be initiated by external applications (like MS Excel, Word etc).

The error means that all your classes are "Private" resp "PublicNotCreatable"
0
 

Author Comment

by:lee88
ID: 17167130
angelIII, thanks for the answer. What does "resp" mean?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17167150
respectively
0
 

Author Comment

by:lee88
ID: 17167389
Thanks again for the answer. (The light bulb finally turns on).  I do have a second application (also written by my subcontract coder years ago) that creates an instance of the first application:

Private modObjKB As Object
Set modObjKB = CreateObject("KioskBrowser.Application")

So, having the first app's type as "ActiveX EXE" and having the Application.cls Class Module, shown above, allows the second app to create an instance of the first app. Correct?

Last question: Does the ".Application" portion of the "KioskBrowser.Application" argument in the CreateObject function refer specifically to the name of the class module, "Application.cls", or is the word "Application" special or intrinsic to VB? ("Application" sounds like a Keyword).

Your help is very much appreciated!


0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17167456
>So, having the first app's type as "ActiveX EXE" and having the Application.cls Class Module, shown above, allows the second app to create an instance of the first app. Correct?
yes.

>Last question: Does the ".Application" portion of the "KioskBrowser.Application" argument in the CreateObject function refer specifically to the name of the class module, "Application.cls", or is the word "Application" special or intrinsic to VB? ("Application" sounds like a Keyword).
Yes.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 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…
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…

920 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

14 Experts available now in Live!

Get 1:1 Help Now