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 / aboutbox.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-08-01  |  11.8 KB  |  342 lines

  1. VERSION 4.00
  2. Begin VB.Form AboutBox 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "About AppCompanyName"
  5.    ClientHeight    =   4095
  6.    ClientLeft      =   1290
  7.    ClientTop       =   1485
  8.    ClientWidth     =   6450
  9.    ClipControls    =   0   'False
  10.    ControlBox      =   0   'False
  11.    BeginProperty Font 
  12.       name            =   "MS Sans Serif"
  13.       charset         =   0
  14.       weight          =   700
  15.       size            =   8.25
  16.       underline       =   0   'False
  17.       italic          =   0   'False
  18.       strikethrough   =   0   'False
  19.    EndProperty
  20.    Height          =   4500
  21.    Icon            =   "aboutbox.frx":0000
  22.    Left            =   1230
  23.    LinkMode        =   1  'Source
  24.    LinkTopic       =   "About"
  25.    MaxButton       =   0   'False
  26.    MinButton       =   0   'False
  27.    ScaleHeight     =   4095
  28.    ScaleWidth      =   6450
  29.    Top             =   1140
  30.    Width           =   6570
  31.    Begin VB.PictureBox pic 
  32.       Appearance      =   0  'Flat
  33.       AutoRedraw      =   -1  'True
  34.       BackColor       =   &H00C0C0C0&
  35.       BorderStyle     =   0  'None
  36.       ClipControls    =   0   'False
  37.       ForeColor       =   &H80000008&
  38.       Height          =   480
  39.       Left            =   120
  40.       Picture         =   "aboutbox.frx":030A
  41.       ScaleHeight     =   480
  42.       ScaleWidth      =   480
  43.       TabIndex        =   15
  44.       Top             =   135
  45.       Width           =   480
  46.    End
  47.    Begin VB.CommandButton cmdSysInfo 
  48.       Caption         =   "&System Info..."
  49.       Height          =   375
  50.       Left            =   4950
  51.       TabIndex        =   14
  52.       Top             =   600
  53.       Visible         =   0   'False
  54.       Width           =   1365
  55.    End
  56.    Begin VB.CommandButton cmdOk 
  57.       Caption         =   "&OK"
  58.       Height          =   375
  59.       Left            =   4950
  60.       TabIndex        =   0
  61.       Top             =   150
  62.       Width           =   1365
  63.    End
  64.    Begin VB.Line Lines 
  65.       BorderWidth     =   2
  66.       Index           =   1
  67.       X1              =   855
  68.       X2              =   6350
  69.       Y1              =   2250
  70.       Y2              =   2250
  71.    End
  72.    Begin VB.Line Lines 
  73.       BorderWidth     =   2
  74.       Index           =   0
  75.       X1              =   885
  76.       X2              =   6350
  77.       Y1              =   2970
  78.       Y2              =   2970
  79.    End
  80.    Begin VB.Label lbl 
  81.       AutoSize        =   -1  'True
  82.       BackStyle       =   0  'Transparent
  83.       Caption         =   "This product is licensed to:"
  84.       Height          =   195
  85.       Index           =   8
  86.       Left            =   855
  87.       TabIndex        =   13
  88.       Top             =   1215
  89.       Width           =   2325
  90.    End
  91.    Begin VB.Label lbl 
  92.       BackStyle       =   0  'Transparent
  93.       Caption         =   "lbl(13) - Free Resources"
  94.       Height          =   255
  95.       Index           =   13
  96.       Left            =   2685
  97.       TabIndex        =   11
  98.       Top             =   3705
  99.       Width           =   2250
  100.    End
  101.    Begin VB.Label lbl 
  102.       BackStyle       =   0  'Transparent
  103.       Caption         =   "System Resources:"
  104.       Height          =   255
  105.       Index           =   12
  106.       Left            =   855
  107.       TabIndex        =   9
  108.       Top             =   3705
  109.       Width           =   1815
  110.    End
  111.    Begin VB.Label lbl 
  112.       BackStyle       =   0  'Transparent
  113.       Caption         =   "lbl(11) - Free RAM"
  114.       Height          =   255
  115.       Index           =   11
  116.       Left            =   2685
  117.       TabIndex        =   10
  118.       Top             =   3435
  119.       Width           =   2295
  120.    End
  121.    Begin VB.Label lbl 
  122.       BackStyle       =   0  'Transparent
  123.       Caption         =   "Memory:"
  124.       Height          =   255
  125.       Index           =   10
  126.       Left            =   855
  127.       TabIndex        =   8
  128.       Top             =   3435
  129.       Width           =   1815
  130.    End
  131.    Begin VB.Label lbl 
  132.       BackStyle       =   0  'Transparent
  133.       Caption         =   "lbl(9) - Windows Mode"
  134.       Height          =   255
  135.       Index           =   9
  136.       Left            =   855
  137.       TabIndex        =   7
  138.       Top             =   3150
  139.       Width           =   3015
  140.    End
  141.    Begin VB.Label lbl 
  142.       BackStyle       =   0  'Transparent
  143.       Caption         =   "lbl(6) - Message"
  144.       Height          =   465
  145.       Index           =   6
  146.       Left            =   855
  147.       TabIndex        =   12
  148.       Top             =   2385
  149.       Width           =   5460
  150.    End
  151.    Begin VB.Label lbl 
  152.       BackStyle       =   0  'Transparent
  153.       Caption         =   "lbl(5) - Registration"
  154.       Height          =   195
  155.       Index           =   5
  156.       Left            =   855
  157.       TabIndex        =   6
  158.       Top             =   1980
  159.       Width           =   4725
  160.    End
  161.    Begin VB.Label lbl 
  162.       BackStyle       =   0  'Transparent
  163.       Caption         =   "lbl(4) - CompanyName"
  164.       Height          =   195
  165.       Index           =   4
  166.       Left            =   855
  167.       TabIndex        =   5
  168.       Top             =   1725
  169.       Width           =   4725
  170.    End
  171.    Begin VB.Label lbl 
  172.       BackStyle       =   0  'Transparent
  173.       Caption         =   "lbl(3) - UserName"
  174.       Height          =   195
  175.       Index           =   3
  176.       Left            =   855
  177.       TabIndex        =   4
  178.       Top             =   1470
  179.       Width           =   4725
  180.    End
  181.    Begin VB.Label lbl 
  182.       BackStyle       =   0  'Transparent
  183.       Caption         =   "lbl(2) - Copyright 
  184.  1995 + AppCompanyName"
  185.       Height          =   255
  186.       Index           =   2
  187.       Left            =   855
  188.       TabIndex        =   3
  189.       Top             =   675
  190.       Width           =   4035
  191.    End
  192.    Begin VB.Label lbl 
  193.       BackStyle       =   0  'Transparent
  194.       Caption         =   "lbl(1) - Version + VersionNumber"
  195.       Height          =   255
  196.       Index           =   1
  197.       Left            =   855
  198.       TabIndex        =   2
  199.       Top             =   405
  200.       Width           =   3555
  201.    End
  202.    Begin VB.Label lbl 
  203.       BackStyle       =   0  'Transparent
  204.       Caption         =   "lbl(0) - AppName"
  205.       Height          =   255
  206.       Index           =   0
  207.       Left            =   855
  208.       TabIndex        =   1
  209.       Top             =   135
  210.       Width           =   3555
  211.    End
  212. Attribute VB_Name = "AboutBox"
  213. Attribute VB_Creatable = False
  214. Attribute VB_Exposed = False
  215. '**************************************************************
  216. ' ABOUTBOX.FRM - This form contains a generic about dialog
  217. '                box which is accessed by the About class.
  218. '                You should never use this form directly.
  219. '**************************************************************
  220. Option Explicit
  221. '**************************************************************
  222. ' API calls for use by this form only.
  223. '**************************************************************
  224. #If Win32 Then
  225. Private Type MEMORYSTATUS
  226.         dwLength As Long
  227.         dwMemoryLoad As Long
  228.         dwTotalPhys As Long
  229.         dwAvailPhys As Long
  230.         dwTotalPageFile As Long
  231.         dwAvailPageFile As Long
  232.         dwTotalVirtual As Long
  233.         dwAvailVirtual As Long
  234. End Type
  235. Private Declare Sub GlobalMemoryStatus Lib "kernel32" _
  236.     (lpBuffer As MEMORYSTATUS)
  237. #Else
  238. Private Declare Function GetFreeSpace Lib "Kernel" (ByVal _
  239.     wFlags%) As Long
  240. Private Declare Function GetFreeSystemResources Lib "User" _
  241.     (ByVal wSysResource%) As Integer
  242. Private Declare Function GetWinFlags Lib "Kernel" () As Long
  243. #End If
  244. '**************************************************************
  245. ' Form level variables for preserving the pointer, and creating
  246. ' and About object.
  247. '**************************************************************
  248. Private OrigPointer As Integer
  249. '**************************************************************
  250. ' Form Intialization
  251. '**************************************************************
  252. Private Sub Form_Load()
  253. #If Win32 Then
  254. Dim MemoryStat As MEMORYSTATUS
  255. #Else
  256. Const WF_ENHANCED = &H20
  257. Const GFSR_SYSTEMRESOURCES = &H0
  258. #End If
  259.     '**********************************************************
  260.     ' Remember the current pointer, and change it to an hrglass
  261.     '**********************************************************
  262.     OrigPointer = Screen.MousePointer
  263.     Screen.MousePointer = vbHourglass
  264.     '**********************************************************
  265.     ' If this form isn't being displayed as a splash screen
  266.     '**********************************************************
  267.     If Not bSplashScreen Then
  268.     '**********************************************************
  269.     ' Set the visible property of the button based on the
  270.     ' existances of msinfo.exe (from Microsoft).
  271.     '**********************************************************
  272.         #If Win32 Then
  273.         cmdSysInfo.Visible = FileExists(GetWinDir(True) _
  274.                          & "msapps\msinfo\msinfo32.exe")
  275.         #Else
  276.         cmdSysInfo.Visible = FileExists(GetWinDir(True) _
  277.                          & "msapps\msinfo\msinfo.exe")
  278.         #End If
  279.     '**********************************************************
  280.     ' NOTE: You CAN NOT distribute MSINFO.EXE, so this is the
  281.     '       next best thing.
  282.     '**********************************************************
  283.     End If
  284.     '**********************************************************
  285.     ' Set the label to reflect the environment mode
  286.     '**********************************************************
  287. #If Win32 Then
  288.     lbl(9) = "Windows (32-bit)"
  289. #Else
  290.     lbl(9) = IIf(GetWinFlags() And WF_ENHANCED, _
  291.                  "386 Enhanced Mode", "Standard Mode")
  292. #End If
  293.     '**********************************************************
  294.     ' Call the API, and format the responses
  295.     '**********************************************************
  296. #If Win32 Then
  297.     GlobalMemoryStatus MemoryStat
  298.     lbl(10) = "Physical Memory"
  299.     lbl(11) = Format(MemoryStat.dwTotalPhys \ 1024, "###,###,##0") & " KB"
  300.     lbl(12) = "Memory Load"
  301.     lbl(13) = Format(MemoryStat.dwMemoryLoad) & "%"
  302. #Else
  303.     lbl(11) = Format$(GetFreeSpace(0) \ 1024, "###,###,##0") & " KB"
  304.     lbl(13) = Format$(GetFreeSystemResources(GFSR_SYSTEMRESOURCES)) & "%"
  305. #End If
  306.     '**********************************************************
  307.     ' Center the form
  308.     '**********************************************************
  309.     Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
  310.     '**********************************************************
  311.     ' Set the pointer to default, so the user doesn't see
  312.     ' and hourglass on the about box.
  313.     '**********************************************************
  314.     Screen.MousePointer = vbDefault
  315. End Sub
  316. '**************************************************************
  317. ' Restore the pointer to its previous state, and free memory
  318. '**************************************************************
  319. Private Sub Form_Unload(Cancel As Integer)
  320.     Screen.MousePointer = OrigPointer
  321.     Set AboutBox = Nothing
  322. End Sub
  323. '**************************************************************
  324. ' Dismiss the dialog box, and run Form_Unload
  325. '**************************************************************
  326. Private Sub cmdOk_Click()
  327.     Unload Me
  328. End Sub
  329. '**************************************************************
  330. ' If this button is visible, then this will work. Since we
  331. ' ignore the return value, you don't need parenthesis or
  332. ' variable = .
  333. '**************************************************************
  334. Private Sub cmdSysInfo_Click()
  335.     #If Win32 Then
  336.         Shell GetWinDir(True) & "msapps\msinfo\msinfo32.exe", _
  337.                                 vbNormalFocus
  338.     #Else
  339.         Shell GetWinDir(True) & "msapps\msinfo\msinfo.exe"
  340.     #End If
  341. End Sub
  342.