home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD90468172000.psc / frmAbout.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-08-17  |  10.3 KB  |  241 lines

  1. VERSION 5.00
  2. Begin VB.Form frmAbout 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "About SurfTabs"
  5.    ClientHeight    =   3705
  6.    ClientLeft      =   2340
  7.    ClientTop       =   1935
  8.    ClientWidth     =   5730
  9.    ClipControls    =   0   'False
  10.    Icon            =   "frmAbout.frx":0000
  11.    LinkTopic       =   "Form2"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2557.257
  15.    ScaleMode       =   0  'User
  16.    ScaleWidth      =   5380.766
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   1  'CenterOwner
  19.    Begin VB.PictureBox picIcon 
  20.       AutoSize        =   -1  'True
  21.       BorderStyle     =   0  'None
  22.       ClipControls    =   0   'False
  23.       Height          =   480
  24.       Left            =   240
  25.       Picture         =   "frmAbout.frx":000C
  26.       ScaleHeight     =   331.61
  27.       ScaleMode       =   0  'User
  28.       ScaleWidth      =   331.61
  29.       TabIndex        =   1
  30.       Top             =   240
  31.       Width           =   480
  32.    End
  33.    Begin VB.CommandButton cmdOK 
  34.       Cancel          =   -1  'True
  35.       Caption         =   "OK"
  36.       Default         =   -1  'True
  37.       Height          =   345
  38.       Left            =   4245
  39.       TabIndex        =   0
  40.       Top             =   2625
  41.       Width           =   1260
  42.    End
  43.    Begin VB.CommandButton cmdSysInfo 
  44.       Caption         =   "&System Info..."
  45.       Height          =   345
  46.       Left            =   4260
  47.       TabIndex        =   2
  48.       Top             =   3120
  49.       Width           =   1245
  50.    End
  51.    Begin VB.Image Image1 
  52.       BorderStyle     =   1  'Fixed Single
  53.       Height          =   960
  54.       Left            =   240
  55.       Picture         =   "frmAbout.frx":044E
  56.       ToolTipText     =   "http://TigerStudios.BlacsksWeb.com"
  57.       Top             =   2640
  58.       Width           =   3825
  59.    End
  60.    Begin VB.Line Line1 
  61.       BorderColor     =   &H00808080&
  62.       BorderStyle     =   6  'Inside Solid
  63.       Index           =   1
  64.       X1              =   84.515
  65.       X2              =   5309.398
  66.       Y1              =   1687.583
  67.       Y2              =   1687.583
  68.    End
  69.    Begin VB.Label lblDescription 
  70.       ForeColor       =   &H00000000&
  71.       Height          =   660
  72.       Left            =   1080
  73.       TabIndex        =   3
  74.       Top             =   1680
  75.       Width           =   3885
  76.    End
  77.    Begin VB.Label lblTitle 
  78.       Caption         =   "Application Title"
  79.       BeginProperty Font 
  80.          Name            =   "MS Sans Serif"
  81.          Size            =   12
  82.          Charset         =   0
  83.          Weight          =   700
  84.          Underline       =   0   'False
  85.          Italic          =   0   'False
  86.          Strikethrough   =   0   'False
  87.       EndProperty
  88.       ForeColor       =   &H00000000&
  89.       Height          =   960
  90.       Left            =   1050
  91.       TabIndex        =   4
  92.       Top             =   240
  93.       Width           =   3885
  94.    End
  95.    Begin VB.Line Line1 
  96.       BorderColor     =   &H00FFFFFF&
  97.       BorderWidth     =   2
  98.       Index           =   0
  99.       X1              =   98.6
  100.       X2              =   5309.398
  101.       Y1              =   1697.936
  102.       Y2              =   1697.936
  103.    End
  104.    Begin VB.Label lblVersion 
  105.       Caption         =   "Version"
  106.       Height          =   225
  107.       Left            =   1020
  108.       TabIndex        =   5
  109.       Top             =   1290
  110.       Width           =   3885
  111.    End
  112. Attribute VB_Name = "frmAbout"
  113. Attribute VB_GlobalNameSpace = False
  114. Attribute VB_Creatable = False
  115. Attribute VB_PredeclaredId = True
  116. Attribute VB_Exposed = False
  117. Option Explicit
  118. '//////////////////////////////////////////////////////////
  119. '// SurfTabs
  120. '// A Tiger Studios product
  121. '// By Jim Black
  122. '// Jim@BlacksWeb.com
  123. '//////////////////////////////////////////////////////////
  124. ' Reg Key Security Options...
  125. Const READ_CONTROL = &H20000
  126. Const KEY_QUERY_VALUE = &H1
  127. Const KEY_SET_VALUE = &H2
  128. Const KEY_CREATE_SUB_KEY = &H4
  129. Const KEY_ENUMERATE_SUB_KEYS = &H8
  130. Const KEY_NOTIFY = &H10
  131. Const KEY_CREATE_LINK = &H20
  132. Const KEY_ALL_ACCESS = KEY_QUERY_VALUE + KEY_SET_VALUE + _
  133.                        KEY_CREATE_SUB_KEY + KEY_ENUMERATE_SUB_KEYS + _
  134.                        KEY_NOTIFY + KEY_CREATE_LINK + READ_CONTROL
  135.                      
  136. ' Reg Key ROOT Types...
  137. Const HKEY_LOCAL_MACHINE = &H80000002
  138. Const ERROR_SUCCESS = 0
  139. Const REG_SZ = 1                         ' Unicode nul terminated string
  140. Const REG_DWORD = 4                      ' 32-bit number
  141. Const gREGKEYSYSINFOLOC = "SOFTWARE\Microsoft\Shared Tools Location"
  142. Const gREGVALSYSINFOLOC = "MSINFO"
  143. Const gREGKEYSYSINFO = "SOFTWARE\Microsoft\Shared Tools\MSINFO"
  144. Const gREGVALSYSINFO = "PATH"
  145. 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
  146. 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
  147. Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
  148. Private Sub cmdSysInfo_Click()
  149.     'Displays Windows System Information
  150.     Call StartSysInfo
  151. End Sub
  152. Private Sub cmdOK_Click()
  153.   Unload Me
  154. End Sub
  155. Private Sub Form_Load()
  156.     'Initialize the form labels
  157.     Me.Caption = "About " & App.Title
  158.     lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
  159.     lblTitle.Caption = App.Title & _
  160.             vbCrLf & "A Tiger Studios product" & _
  161.             vbCrLf & "by Jim Black"
  162.     lblDescription.Caption = "Internet Web Browser" & vbCrLf & _
  163.                     "Surf web sites on different browser tabs."
  164. End Sub
  165. Public Sub StartSysInfo()
  166.     On Error GoTo SysInfoErr
  167.     Dim rc As Long
  168.     Dim SysInfoPath As String
  169.     ' Try To Get System Info Program Path\Name From Registry...
  170.     If GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFO, gREGVALSYSINFO, SysInfoPath) Then
  171.     ' Try To Get System Info Program Path Only From Registry...
  172.     ElseIf GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFOLOC, gREGVALSYSINFOLOC, SysInfoPath) Then
  173.         ' Validate Existance Of Known 32 Bit File Version
  174.         If (Dir(SysInfoPath & "\MSINFO32.EXE") <> "") Then
  175.             SysInfoPath = SysInfoPath & "\MSINFO32.EXE"
  176.             
  177.         ' Error - File Can Not Be Found...
  178.         Else
  179.             GoTo SysInfoErr
  180.         End If
  181.     ' Error - Registry Entry Can Not Be Found...
  182.     Else
  183.         GoTo SysInfoErr
  184.     End If
  185.     Call Shell(SysInfoPath, vbNormalFocus)
  186.     Exit Sub
  187. SysInfoErr:
  188.     MsgBox "System Information Is Unavailable At This Time", vbOKOnly
  189. End Sub
  190. Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean
  191.     Dim i As Long                                           ' Loop Counter
  192.     Dim rc As Long                                          ' Return Code
  193.     Dim hKey As Long                                        ' Handle To An Open Registry Key
  194.     Dim hDepth As Long                                      '
  195.     Dim KeyValType As Long                                  ' Data Type Of A Registry Key
  196.     Dim tmpVal As String                                    ' Tempory Storage For A Registry Key Value
  197.     Dim KeyValSize As Long                                  ' Size Of Registry Key Variable
  198.     '------------------------------------------------------------
  199.     ' Open RegKey Under KeyRoot {HKEY_LOCAL_MACHINE...}
  200.     '------------------------------------------------------------
  201.     rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) ' Open Registry Key
  202.     If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError          ' Handle Error...
  203.     tmpVal = String$(1024, 0)                             ' Allocate Variable Space
  204.     KeyValSize = 1024                                       ' Mark Variable Size
  205.     '------------------------------------------------------------
  206.     ' Retrieve Registry Key Value...
  207.     '------------------------------------------------------------
  208.     rc = RegQueryValueEx(hKey, SubKeyRef, 0, _
  209.                          KeyValType, tmpVal, KeyValSize)    ' Get/Create Key Value
  210.                         
  211.     If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError          ' Handle Errors
  212.     If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then           ' Win95 Adds Null Terminated String...
  213.         tmpVal = Left(tmpVal, KeyValSize - 1)               ' Null Found, Extract From String
  214.     Else                                                    ' WinNT Does NOT Null Terminate String...
  215.         tmpVal = Left(tmpVal, KeyValSize)                   ' Null Not Found, Extract String Only
  216.     End If
  217.     '------------------------------------------------------------
  218.     ' Determine Key Value Type For Conversion...
  219.     '------------------------------------------------------------
  220.     Select Case KeyValType                                  ' Search Data Types...
  221.     Case REG_SZ                                             ' String Registry Key Data Type
  222.         KeyVal = tmpVal                                     ' Copy String Value
  223.     Case REG_DWORD                                          ' Double Word Registry Key Data Type
  224.         For i = Len(tmpVal) To 1 Step -1                    ' Convert Each Bit
  225.             KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1)))   ' Build Value Char. By Char.
  226.         Next
  227.         KeyVal = Format$("&h" + KeyVal)                     ' Convert Double Word To String
  228.     End Select
  229.     GetKeyValue = True                                      ' Return Success
  230.     rc = RegCloseKey(hKey)                                  ' Close Registry Key
  231.     Exit Function                                           ' Exit
  232. GetKeyError:      ' Cleanup After An Error Has Occured...
  233.     KeyVal = ""                                             ' Set Return Val To Empty String
  234.     GetKeyValue = False                                     ' Return Failure
  235.     rc = RegCloseKey(hKey)                                  ' Close Registry Key
  236. End Function
  237. Private Sub Image1_Click()
  238.     frmBrowser.cboAddress.text = "http://TigerStudios.BlacksWeb.com"
  239.     cmdOK_Click
  240. End Sub
  241.