home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Programmer'…arterly (Limited Edition)
/
Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso
/
code
/
ch26code
/
about.cls
next >
Wrap
Text File
|
1995-08-01
|
8KB
|
181 lines
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "About"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
'**************************************************************
' ABOUT.CLS - This is the About class which is used to display
' the about dialog. Its Creatable and Public
' properties have been set so that it is only
' visible to this project.
'**************************************************************
Option Explicit
'**************************************************************
' Declare private variables for your properties as Variant so
' you can take advantage of IsEmpty(). Rememeber that Variants
' are very inefficent because they are the largest data type,
' so you should try to limit your use of them.
' I included variants, just to demonstrate a varity of
' techniques, but I normally avoid variants at all costs.
'**************************************************************
Private App, AppCompany, VerNum, User, Company
Private RegNum, AboutMsg
'**************************************************************
' NOTE: For all of the following properties, if a Get is
' performed before a Let, then a default value will be
' returned. However, this value is NOT stored in its
' related private variable.
'**************************************************************
'**************************************************************
' This is a Read/Write property which should be set with the
' name of the program that is using this object.
'**************************************************************
Public Property Let AppName(str As String)
App = str
End Property
Public Property Get AppName() As String
AppName = IIf(IsEmpty(App), "AppName Default", App)
End Property
'**************************************************************
' This is a Read/Write property which should be set with the
' name of the company who wrote the application that is
' calling this object.
'**************************************************************
Public Property Let AppCompanyName(str As String)
Attribute AppCompanyName.VB_Description = "The software vendors name who will appear in the about box. (Read/Write)"
AppCompany = str
End Property
Public Property Get AppCompanyName() As String
AppCompanyName = IIf(IsEmpty(AppCompany), _
"AppCompanyName Default", AppCompany)
End Property
'**************************************************************
' This is a Read/Write property which should be set with the
' version number of the application which is using this object.
'**************************************************************
Public Property Let VersionNumber(str As String)
Attribute VersionNumber.VB_Description = "The version number of the calling application as you want it to appear in the about box. (Read/Write)"
VerNum = str
End Property
Public Property Get VersionNumber() As String
VersionNumber = IIf(IsEmpty(VerNum), "1.00", VerNum)
End Property
'**************************************************************
' This is a Read/Write property which should be set with the
' name of the end user who is using your application.
'**************************************************************
Public Property Let UserName(str As String)
User = str
End Property
Public Property Get UserName() As String
UserName = IIf(IsEmpty(User), "UserName Default", User)
End Property
'**************************************************************
' This is a Read/Write property which should be set with the
' user's (see above) company name.
'**************************************************************
Public Property Let CompanyName(str As String)
Attribute CompanyName.VB_Description = "The end user's company name that will appear in the about box. (Read/Write)"
Company = str
End Property
Public Property Get CompanyName() As String
CompanyName = IIf(IsEmpty(Company), "CompanyName Default", _
Company)
End Property
'**************************************************************
' This is a Read/Write property which should be set with a
' registration or serial number of the product that called
' this object.
'**************************************************************
Public Property Let Registration(str As String)
Attribute Registration.VB_Description = "The registration or serial number you want to appear in the about box. (Read/Write)"
RegNum = str
End Property
Public Property Get Registration() As String
Registration = IIf(IsEmpty(RegNum), "Registration Default", _
RegNum)
End Property
'**************************************************************
' This is a Read/Write property which can contain up to 2
' lines of text to display in the about box. The text will
' automatically wrap, so carriage returns aren't required.
'**************************************************************
Public Property Let Message(str As String)
Attribute Message.VB_Description = "Any any additional info you want to appear in the about box between the black lines. (Read/Write)"
AboutMsg = str
End Property
Public Property Get Message() As String
Message = IIf(IsEmpty(AboutMsg), "Message Default", AboutMsg)
End Property
'**************************************************************
' This method detrmines how the dialog box should be displayed,
' then it loads it with the appropriate values and displays it.
'**************************************************************
Public Sub ShowAbout(AsSplash As Boolean)
'**********************************************************
' Set the variable so the about box knows how to
' display itself.
'**********************************************************
bSplashScreen = AsSplash
'**********************************************************
' Set the common elements used by the splash screen and
' about box.
'**********************************************************
With AboutBox
.lbl(0) = AppName
.lbl(1) = "Version " & VersionNumber
.lbl(2) = "Copyright ⌐ " & Year(Now) & " " & AppCompanyName
.lbl(3) = UserName
.lbl(4) = CompanyName
.lbl(5) = Registration
.lbl(6) = Message
End With
If AsSplash Then
'******************************************************
' Show About Box as Splash Screen by removing its
' caption, hiding the ok button, and displaying it as
' modeless.
'******************************************************
With AboutBox
.cmdOk.Visible = False
.Caption = ""
.Show
'**************************************************
' NOTE: This refresh is required, because splash
' screens are usually show during peak
' processing times. If you don't refresh,
' then you'll just display a white form.
'**************************************************
.Refresh
End With
'******************************************************
' Set the about box on top to prevent it from
' disappearing during event processing.
'******************************************************
AlwaysOnTop AboutBox.hwnd, False
Else
With AboutBox
.cmdOk.Visible = True
.Caption = "About " & AppCompanyName
.Show 1
End With
End If
End Sub
'**************************************************************
' Unloads the about box
'**************************************************************
Public Sub HideSplash()
Unload AboutBox
End Sub