Solved

Mystery Class Module purpose?

Posted on 2006-07-24
6
582 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
Comment Utility
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
Comment Utility
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
Comment Utility
angelIII, thanks for the answer. What does "resp" mean?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
respectively
0
 

Author Comment

by:lee88
Comment Utility
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]
Comment Utility
>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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…

763 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

12 Experts available now in Live!

Get 1:1 Help Now