home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / A_Folder_&206340512007.psc / frmAbout.frm < prev    next >
Text File  |  2007-04-30  |  14KB  |  331 lines

  1. VERSION 5.00
  2. Begin VB.Form frmAbout 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "About MyApp"
  5.    ClientHeight    =   7410
  6.    ClientLeft      =   2250
  7.    ClientTop       =   1935
  8.    ClientWidth     =   13215
  9.    ClipControls    =   0   'False
  10.    LinkTopic       =   "Form2"
  11.    LockControls    =   -1  'True
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   5114.514
  15.    ScaleMode       =   0  'User
  16.    ScaleWidth      =   12409.57
  17.    ShowInTaskbar   =   0   'False
  18.    Begin VB.CommandButton cmdPrev 
  19.       Cancel          =   -1  'True
  20.       Caption         =   "< &Back"
  21.       Default         =   -1  'True
  22.       Enabled         =   0   'False
  23.       Height          =   345
  24.       Left            =   3049
  25.       TabIndex        =   7
  26.       Top             =   6737
  27.       Width           =   1260
  28.    End
  29.    Begin VB.CommandButton cmdNext 
  30.       Caption         =   "&Next >"
  31.       Height          =   345
  32.       Left            =   4646
  33.       TabIndex        =   6
  34.       Top             =   6720
  35.       Width           =   1260
  36.    End
  37.    Begin VB.PictureBox picIcon 
  38.       AutoSize        =   -1  'True
  39.       ClipControls    =   0   'False
  40.       Height          =   540
  41.       Left            =   240
  42.       Picture         =   "frmAbout.frx":0000
  43.       ScaleHeight     =   337.12
  44.       ScaleMode       =   0  'User
  45.       ScaleWidth      =   337.12
  46.       TabIndex        =   1
  47.       Top             =   240
  48.       Width           =   540
  49.    End
  50.    Begin VB.CommandButton cmdOK 
  51.       Caption         =   "OK"
  52.       Height          =   345
  53.       Left            =   8906
  54.       TabIndex        =   0
  55.       Top             =   6737
  56.       Width           =   1260
  57.    End
  58.    Begin VB.CommandButton cmdSysInfo 
  59.       Caption         =   "&System Info..."
  60.       Height          =   345
  61.       Left            =   7308
  62.       TabIndex        =   2
  63.       Top             =   6737
  64.       Width           =   1245
  65.    End
  66.    Begin VB.Line Line1 
  67.       BorderColor     =   &H00808080&
  68.       BorderStyle     =   6  'Inside Solid
  69.       Index           =   1
  70.       X1              =   84.515
  71.       X2              =   12171.99
  72.       Y1              =   4451.905
  73.       Y2              =   4451.905
  74.    End
  75.    Begin VB.Label lblDescription 
  76.       Caption         =   "App Description"
  77.       BeginProperty Font 
  78.          Name            =   "Courier New"
  79.          Size            =   11.25
  80.          Charset         =   0
  81.          Weight          =   400
  82.          Underline       =   0   'False
  83.          Italic          =   0   'False
  84.          Strikethrough   =   0   'False
  85.       EndProperty
  86.       ForeColor       =   &H00000000&
  87.       Height          =   5220
  88.       Left            =   150
  89.       TabIndex        =   3
  90.       Top             =   1125
  91.       Width           =   12945
  92.    End
  93.    Begin VB.Label lblTitle 
  94.       Caption         =   "Application Title"
  95.       ForeColor       =   &H00000000&
  96.       Height          =   195
  97.       Left            =   1044
  98.       TabIndex        =   4
  99.       Top             =   240
  100.       Width           =   3546
  101.    End
  102.    Begin VB.Line Line1 
  103.       BorderColor     =   &H00FFFFFF&
  104.       BorderWidth     =   2
  105.       Index           =   0
  106.       X1              =   84.515
  107.       X2              =   12171.99
  108.       Y1              =   4472.611
  109.       Y2              =   4472.611
  110.    End
  111.    Begin VB.Label lblVersion 
  112.       Caption         =   "Version"
  113.       Height          =   195
  114.       Left            =   1044
  115.       TabIndex        =   5
  116.       Top             =   600
  117.       Width           =   3546
  118.    End
  119. End
  120. Attribute VB_Name = "frmAbout"
  121. Attribute VB_GlobalNameSpace = False
  122. Attribute VB_Creatable = False
  123. Attribute VB_PredeclaredId = True
  124. Attribute VB_Exposed = False
  125. Option Explicit
  126.  
  127. ' Reg Key Security Options...
  128. Const READ_CONTROL = &H20000
  129. Const KEY_QUERY_VALUE = &H1
  130. Const KEY_SET_VALUE = &H2
  131. Const KEY_CREATE_SUB_KEY = &H4
  132. Const KEY_ENUMERATE_SUB_KEYS = &H8
  133. Const KEY_NOTIFY = &H10
  134. Const KEY_CREATE_LINK = &H20
  135. Const KEY_ALL_ACCESS = KEY_QUERY_VALUE + KEY_SET_VALUE + _
  136.                        KEY_CREATE_SUB_KEY + KEY_ENUMERATE_SUB_KEYS + _
  137.                        KEY_NOTIFY + KEY_CREATE_LINK + READ_CONTROL
  138.                      
  139. ' Reg Key ROOT Types...
  140. Const HKEY_LOCAL_MACHINE = &H80000002
  141. Const ERROR_SUCCESS = 0
  142. Const REG_SZ = 1                         ' Unicode nul terminated string
  143. Const REG_DWORD = 4                      ' 32-bit number
  144.  
  145. Const gREGKEYSYSINFOLOC = "SOFTWARE\Microsoft\Shared Tools Location"
  146. Const gREGVALSYSINFOLOC = "MSINFO"
  147. Const gREGKEYSYSINFO = "SOFTWARE\Microsoft\Shared Tools\MSINFO"
  148. Const gREGVALSYSINFO = "PATH"
  149.  
  150. Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, ByRef phkResult As Long) As Long
  151. Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long
  152. Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
  153.  
  154. Private iWhichShowing As Integer
  155. Private Const MAX_SHOWING = 3
  156. Sub ShowLabel()
  157.   
  158.   Select Case iWhichShowing
  159.   
  160.   Case 1
  161.     lblDescription = "Operational overview" & vbCrLf & _
  162.                       vbCrLf & _
  163.                       "The default operation of this backup is to create a single output path and update that single" & vbCrLf & _
  164.                       "copywith each run.  You can force a full backup of the source path on the first run and then" & vbCrLf & _
  165.                       "update theoutput path with only the changed files on subsequent runs.  This is the simpliest" & vbCrLf & _
  166.                       "execution and is a way to keep an up-to-date copy of a path on a separate hard drive.  This" & vbCrLf & _
  167.                       "hard drive can be local, USB or NAS." & vbCrLf & _
  168.                       vbCrLf & _
  169.                       "The other operational mode is differential copy.  In this mode, the date or date and time is" & vbCrLf & _
  170.                       "insered into the output path.  This mode allows the user to maintain multiple versions of" & vbCrLf & _
  171.                       "frequently changed files. Each backuped up version will be in a separate output path by date or" & vbCrLf & _
  172.                       "date and time.  Frequency of runswill determine how many versions of changed files will be" & vbCrLf & _
  173.                       "saved." & vbCrLf & _
  174.                       vbCrLf & _
  175.                       "Press 'Next' and 'Back' for additional information."
  176.  
  177.   Case 2
  178.     lblDescription = "There are seven input parms to this program.  If 'i', 'q' or 'o' are input, then all three of them must be input.  " & _
  179.                      "'f', 'd', 't' and 's' are idependent and can be used as desired with 'i', 'q' and 'o'." & vbCrLf & _
  180.                      vbCrLf & _
  181.                      "Here are the parms:" & vbCrLf & _
  182.                      "-i   is full path for top level to copy.  All lower levels will be copied." & vbCrLf & _
  183.                      "-q   is the high level qualifier to use to put the files under.  If missing, 'Backup' is used." & vbCrLf & _
  184.                      "-o   is the letter of the output drive on which to place the backup tree structure." & vbCrLf & _
  185.                      "      Do not include a direcory name, just a single letter." & vbCrLf & _
  186.                      "-f   (switch -- no parms required) sets a forced full backup of the entire tree." & vbCrLf & _
  187.                      "-s   (switch -- no parms required) only simulate the copy and log it, do not copy any files." & vbCrLf & _
  188.                      "-d   (switch -- no parms required) sets the mode to date differential." & vbCrLf & _
  189.                      "      A new output path will be created for runs each day with only the files changed since last" & vbCrLf & _
  190.                      "      run." & vbCrLf & _
  191.                      "-d   (switch -- no parms required) sets the mode to date differential." & vbCrLf & _
  192.                      "      A new folder will be created daily with only the files changed since last day/run." & vbCrLf & _
  193.                      "-t   (switch -- no parms required) sets the mode to date/time differential." & vbCrLf & _
  194.                      "      A new folder will be created for each run with only the files changed since last run."
  195.   Case 3
  196.     lblDescription = "The parameters IDs (-i, -q, -o, -f, -d && -s) can be either upper or lower case." & vbCrLf & _
  197.                      "The parameters are case sensitive.  If you want really 'frEMbish' for high qualifier level, type it exactly that way." & vbCrLf & _
  198.                      vbCrLf & _
  199.                      "Note: Path && directory names MAY have spaces and all other valid Windows path/file name characters."
  200.     
  201.     End Select
  202.   
  203. End Sub
  204.  
  205. Private Sub cmdNext_Click()
  206.  
  207.   cmdPrev.Enabled = True
  208.   
  209.   If iWhichShowing < MAX_SHOWING Then iWhichShowing = iWhichShowing + 1
  210.   If iWhichShowing = MAX_SHOWING Then cmdNext.Enabled = False
  211.   
  212.   ShowLabel
  213.  
  214. End Sub
  215.  
  216.  
  217. Private Sub cmdPrev_Click()
  218.  
  219.   cmdNext.Enabled = True
  220.   
  221.   If iWhichShowing > 1 Then iWhichShowing = iWhichShowing - 1
  222.   If iWhichShowing = 1 Then cmdPrev.Enabled = False
  223.   
  224.   ShowLabel
  225.   
  226.   
  227. End Sub
  228.  
  229.  
  230. Private Sub cmdSysInfo_Click()
  231.   Call StartSysInfo
  232. End Sub
  233.  
  234. Private Sub cmdOK_Click()
  235.   Unload Me
  236. End Sub
  237.  
  238. Private Sub Form_Load()
  239.   Me.Caption = "About " & App.Title
  240.   lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
  241.   lblTitle.Caption = App.Title
  242.   
  243.   iWhichShowing = 1
  244.   ShowLabel
  245.                      
  246. End Sub
  247. Public Sub StartSysInfo()
  248.     On Error GoTo SysInfoErr
  249.   
  250.     Dim rc As Long
  251.     Dim SysInfoPath As String
  252.     
  253.     ' Try To Get System Info Program Path\Name From Registry...
  254.     If GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFO, gREGVALSYSINFO, SysInfoPath) Then
  255.     ' Try To Get System Info Program Path Only From Registry...
  256.     ElseIf GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFOLOC, gREGVALSYSINFOLOC, SysInfoPath) Then
  257.         ' Validate Existance Of Known 32 Bit File Version
  258.         If (Dir(SysInfoPath & "\MSINFO32.EXE") <> "") Then
  259.             SysInfoPath = SysInfoPath & "\MSINFO32.EXE"
  260.             
  261.         ' Error - File Can Not Be Found...
  262.         Else
  263.             GoTo SysInfoErr
  264.         End If
  265.     ' Error - Registry Entry Can Not Be Found...
  266.     Else
  267.         GoTo SysInfoErr
  268.     End If
  269.     
  270.     Call Shell(SysInfoPath, vbNormalFocus)
  271.     
  272.     Exit Sub
  273. SysInfoErr:
  274.     MsgBox "System Information Is Unavailable At This Time", vbOKOnly
  275. End Sub
  276.  
  277. Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean
  278.     Dim i As Long                                           ' Loop Counter
  279.     Dim rc As Long                                          ' Return Code
  280.     Dim hKey As Long                                        ' Handle To An Open Registry Key
  281.     Dim hDepth As Long                                      '
  282.     Dim KeyValType As Long                                  ' Data Type Of A Registry Key
  283.     Dim tmpVal As String                                    ' Tempory Storage For A Registry Key Value
  284.     Dim KeyValSize As Long                                  ' Size Of Registry Key Variable
  285.     '------------------------------------------------------------
  286.     ' Open RegKey Under KeyRoot {HKEY_LOCAL_MACHINE...}
  287.     '------------------------------------------------------------
  288.     rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) ' Open Registry Key
  289.     
  290.     If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError          ' Handle Error...
  291.     
  292.     tmpVal = String$(1024, 0)                             ' Allocate Variable Space
  293.     KeyValSize = 1024                                       ' Mark Variable Size
  294.     
  295.     '------------------------------------------------------------
  296.     ' Retrieve Registry Key Value...
  297.     '------------------------------------------------------------
  298.     rc = RegQueryValueEx(hKey, SubKeyRef, 0, _
  299.                          KeyValType, tmpVal, KeyValSize)    ' Get/Create Key Value
  300.                         
  301.     If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError          ' Handle Errors
  302.     
  303.     If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then           ' Win95 Adds Null Terminated String...
  304.         tmpVal = Left(tmpVal, KeyValSize - 1)               ' Null Found, Extract From String
  305.     Else                                                    ' WinNT Does NOT Null Terminate String...
  306.         tmpVal = Left(tmpVal, KeyValSize)                   ' Null Not Found, Extract String Only
  307.     End If
  308.     '------------------------------------------------------------
  309.     ' Determine Key Value Type For Conversion...
  310.     '------------------------------------------------------------
  311.     Select Case KeyValType                                  ' Search Data Types...
  312.     Case REG_SZ                                             ' String Registry Key Data Type
  313.         KeyVal = tmpVal                                     ' Copy String Value
  314.     Case REG_DWORD                                          ' Double Word Registry Key Data Type
  315.         For i = Len(tmpVal) To 1 Step -1                    ' Convert Each Bit
  316.             KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1)))   ' Build Value Char. By Char.
  317.         Next
  318.         KeyVal = Format$("&h" + KeyVal)                     ' Convert Double Word To String
  319.     End Select
  320.     
  321.     GetKeyValue = True                                      ' Return Success
  322.     rc = RegCloseKey(hKey)                                  ' Close Registry Key
  323.     Exit Function                                           ' Exit
  324.     
  325. GetKeyError:      ' Cleanup After An Error Has Occured...
  326.     KeyVal = ""                                             ' Set Return Val To Empty String
  327.     GetKeyValue = False                                     ' Return Failure
  328.     rc = RegCloseKey(hKey)                                  ' Close Registry Key
  329. End Function
  330.  
  331.