home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / DNote2057553312007.psc / DNote / forms / frmAbout.frm next >
Text File  |  2007-04-01  |  14KB  |  369 lines

  1. VERSION 5.00
  2. Begin VB.Form frmAbout 
  3.    BackColor       =   &H80000012&
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "About MyApp"
  6.    ClientHeight    =   4455
  7.    ClientLeft      =   2340
  8.    ClientTop       =   1935
  9.    ClientWidth     =   4605
  10.    ClipControls    =   0   'False
  11.    Icon            =   "frmAbout.frx":0000
  12.    LinkTopic       =   "Form2"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   3074.92
  16.    ScaleMode       =   0  'User
  17.    ScaleWidth      =   4324.333
  18.    ShowInTaskbar   =   0   'False
  19.    StartUpPosition =   2  'CenterScreen
  20.    Begin VB.PictureBox Picture1 
  21.       Appearance      =   0  'Flat
  22.       BackColor       =   &H80000005&
  23.       ForeColor       =   &H80000008&
  24.       Height          =   2775
  25.       Left            =   120
  26.       ScaleHeight     =   2745
  27.       ScaleWidth      =   705
  28.       TabIndex        =   6
  29.       Top             =   120
  30.       Width           =   735
  31.       Begin VB.PictureBox picIcon 
  32.          AutoSize        =   -1  'True
  33.          BackColor       =   &H80000009&
  34.          BorderStyle     =   0  'None
  35.          ClipControls    =   0   'False
  36.          BeginProperty Font 
  37.             Name            =   "Arial"
  38.             Size            =   8.25
  39.             Charset         =   0
  40.             Weight          =   400
  41.             Underline       =   0   'False
  42.             Italic          =   0   'False
  43.             Strikethrough   =   0   'False
  44.          EndProperty
  45.          Height          =   480
  46.          Left            =   120
  47.          Picture         =   "frmAbout.frx":030A
  48.          ScaleHeight     =   337.12
  49.          ScaleMode       =   0  'User
  50.          ScaleWidth      =   337.12
  51.          TabIndex        =   7
  52.          Top             =   120
  53.          Width           =   480
  54.       End
  55.    End
  56.    Begin VB.CommandButton cmdOK 
  57.       Cancel          =   -1  'True
  58.       Caption         =   "OK"
  59.       Default         =   -1  'True
  60.       BeginProperty Font 
  61.          Name            =   "Arial"
  62.          Size            =   8.25
  63.          Charset         =   0
  64.          Weight          =   400
  65.          Underline       =   0   'False
  66.          Italic          =   0   'False
  67.          Strikethrough   =   0   'False
  68.       EndProperty
  69.       Height          =   345
  70.       Left            =   3240
  71.       TabIndex        =   0
  72.       Top             =   3120
  73.       Width           =   1260
  74.    End
  75.    Begin VB.CommandButton cmdSysInfo 
  76.       Caption         =   "&System Info..."
  77.       BeginProperty Font 
  78.          Name            =   "Arial"
  79.          Size            =   8.25
  80.          Charset         =   0
  81.          Weight          =   400
  82.          Underline       =   0   'False
  83.          Italic          =   0   'False
  84.          Strikethrough   =   0   'False
  85.       EndProperty
  86.       Height          =   345
  87.       Left            =   3240
  88.       TabIndex        =   1
  89.       Top             =   3600
  90.       Width           =   1245
  91.    End
  92.    Begin VB.Label Label3 
  93.       BackStyle       =   0  'Transparent
  94.       Caption         =   "2007 Saga"
  95.       BeginProperty Font 
  96.          Name            =   "Arial"
  97.          Size            =   8.25
  98.          Charset         =   0
  99.          Weight          =   400
  100.          Underline       =   0   'False
  101.          Italic          =   -1  'True
  102.          Strikethrough   =   0   'False
  103.       EndProperty
  104.       ForeColor       =   &H00FFFFFF&
  105.       Height          =   225
  106.       Left            =   960
  107.       TabIndex        =   10
  108.       Top             =   840
  109.       Width           =   3525
  110.    End
  111.    Begin VB.Label Label2 
  112.       BackStyle       =   0  'Transparent
  113.       Caption         =   "For Win32 NT Base Windows OS"
  114.       BeginProperty Font 
  115.          Name            =   "Arial"
  116.          Size            =   8.25
  117.          Charset         =   0
  118.          Weight          =   400
  119.          Underline       =   0   'False
  120.          Italic          =   -1  'True
  121.          Strikethrough   =   0   'False
  122.       EndProperty
  123.       ForeColor       =   &H00FFFFFF&
  124.       Height          =   225
  125.       Left            =   960
  126.       TabIndex        =   9
  127.       Top             =   360
  128.       Width           =   3525
  129.    End
  130.    Begin VB.Label Label1 
  131.       BackStyle       =   0  'Transparent
  132.       Caption         =   "www.saga.trap17.com"
  133.       BeginProperty Font 
  134.          Name            =   "Tahoma"
  135.          Size            =   8.25
  136.          Charset         =   0
  137.          Weight          =   400
  138.          Underline       =   0   'False
  139.          Italic          =   -1  'True
  140.          Strikethrough   =   0   'False
  141.       EndProperty
  142.       ForeColor       =   &H8000000E&
  143.       Height          =   255
  144.       Left            =   960
  145.       TabIndex        =   8
  146.       Top             =   2640
  147.       Width           =   3495
  148.    End
  149.    Begin VB.Label lblDescription 
  150.       BackStyle       =   0  'Transparent
  151.       Caption         =   $"frmAbout.frx":0614
  152.       BeginProperty Font 
  153.          Name            =   "Arial"
  154.          Size            =   8.25
  155.          Charset         =   0
  156.          Weight          =   400
  157.          Underline       =   0   'False
  158.          Italic          =   0   'False
  159.          Strikethrough   =   0   'False
  160.       EndProperty
  161.       ForeColor       =   &H00FFFFFF&
  162.       Height          =   1290
  163.       Left            =   960
  164.       TabIndex        =   2
  165.       Top             =   1200
  166.       Width           =   3525
  167.    End
  168.    Begin VB.Label lblTitle 
  169.       BackStyle       =   0  'Transparent
  170.       Caption         =   "Application Title"
  171.       BeginProperty Font 
  172.          Name            =   "Arial"
  173.          Size            =   9
  174.          Charset         =   0
  175.          Weight          =   700
  176.          Underline       =   0   'False
  177.          Italic          =   0   'False
  178.          Strikethrough   =   0   'False
  179.       EndProperty
  180.       ForeColor       =   &H00FFFFFF&
  181.       Height          =   240
  182.       Left            =   960
  183.       TabIndex        =   4
  184.       Top             =   120
  185.       Width           =   3525
  186.    End
  187.    Begin VB.Line Line1 
  188.       BorderColor     =   &H00FFFFFF&
  189.       BorderWidth     =   2
  190.       Index           =   0
  191.       X1              =   112.686
  192.       X2              =   4169.39
  193.       Y1              =   2070.653
  194.       Y2              =   2070.653
  195.    End
  196.    Begin VB.Label lblVersion 
  197.       BackStyle       =   0  'Transparent
  198.       Caption         =   "Version"
  199.       BeginProperty Font 
  200.          Name            =   "Arial"
  201.          Size            =   8.25
  202.          Charset         =   0
  203.          Weight          =   400
  204.          Underline       =   0   'False
  205.          Italic          =   -1  'True
  206.          Strikethrough   =   0   'False
  207.       EndProperty
  208.       ForeColor       =   &H00FFFFFF&
  209.       Height          =   225
  210.       Left            =   960
  211.       TabIndex        =   5
  212.       Top             =   600
  213.       Width           =   3525
  214.    End
  215.    Begin VB.Label lblDisclaimer 
  216.       BackStyle       =   0  'Transparent
  217.       Caption         =   $"frmAbout.frx":0713
  218.       BeginProperty Font 
  219.          Name            =   "Arial"
  220.          Size            =   8.25
  221.          Charset         =   0
  222.          Weight          =   400
  223.          Underline       =   0   'False
  224.          Italic          =   0   'False
  225.          Strikethrough   =   0   'False
  226.       EndProperty
  227.       ForeColor       =   &H00FFFFFF&
  228.       Height          =   1305
  229.       Left            =   240
  230.       TabIndex        =   3
  231.       Top             =   3105
  232.       Width           =   2775
  233.    End
  234. End
  235. Attribute VB_Name = "frmAbout"
  236. Attribute VB_GlobalNameSpace = False
  237. Attribute VB_Creatable = False
  238. Attribute VB_PredeclaredId = True
  239. Attribute VB_Exposed = False
  240. Option Explicit
  241.  
  242. ' Reg Key Security Options...
  243. Const READ_CONTROL = &H20000
  244. Const KEY_QUERY_VALUE = &H1
  245. Const KEY_SET_VALUE = &H2
  246. Const KEY_CREATE_SUB_KEY = &H4
  247. Const KEY_ENUMERATE_SUB_KEYS = &H8
  248. Const KEY_NOTIFY = &H10
  249. Const KEY_CREATE_LINK = &H20
  250. Const KEY_ALL_ACCESS = KEY_QUERY_VALUE + KEY_SET_VALUE + _
  251.                        KEY_CREATE_SUB_KEY + KEY_ENUMERATE_SUB_KEYS + _
  252.                        KEY_NOTIFY + KEY_CREATE_LINK + READ_CONTROL
  253.                      
  254. ' Reg Key ROOT Types...
  255. Const HKEY_LOCAL_MACHINE = &H80000002
  256. Const ERROR_SUCCESS = 0
  257. Const REG_SZ = 1                         ' Unicode nul terminated string
  258. Const REG_DWORD = 4                      ' 32-bit number
  259.  
  260. Const gREGKEYSYSINFOLOC = "SOFTWARE\Microsoft\Shared Tools Location"
  261. Const gREGVALSYSINFOLOC = "MSINFO"
  262. Const gREGKEYSYSINFO = "SOFTWARE\Microsoft\Shared Tools\MSINFO"
  263. Const gREGVALSYSINFO = "PATH"
  264.  
  265. 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
  266. 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
  267. Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
  268.  
  269.  
  270. Private Sub cmdSysInfo_Click()
  271.   Call StartSysInfo
  272. End Sub
  273.  
  274. Private Sub cmdOK_Click()
  275.   Unload Me
  276. End Sub
  277.  
  278. Private Sub Form_Load()
  279.     Me.BackColor = RGB(54, 54, 54)
  280.     Me.Caption = "About " & App.Title
  281.     lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
  282.     lblTitle.Caption = App.Title
  283. End Sub
  284.  
  285. Public Sub StartSysInfo()
  286.     On Error GoTo SysInfoErr
  287.   
  288.     Dim rc As Long
  289.     Dim SysInfoPath As String
  290.     
  291.     ' Try To Get System Info Program Path\Name From Registry...
  292.     If GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFO, gREGVALSYSINFO, SysInfoPath) Then
  293.     ' Try To Get System Info Program Path Only From Registry...
  294.     ElseIf GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFOLOC, gREGVALSYSINFOLOC, SysInfoPath) Then
  295.         ' Validate Existance Of Known 32 Bit File Version
  296.         If (Dir(SysInfoPath & "\MSINFO32.EXE") <> "") Then
  297.             SysInfoPath = SysInfoPath & "\MSINFO32.EXE"
  298.             
  299.         ' Error - File Can Not Be Found...
  300.         Else
  301.             GoTo SysInfoErr
  302.         End If
  303.     ' Error - Registry Entry Can Not Be Found...
  304.     Else
  305.         GoTo SysInfoErr
  306.     End If
  307.     
  308.     Call Shell(SysInfoPath, vbNormalFocus)
  309.     
  310.     Exit Sub
  311. SysInfoErr:
  312.     MsgBox "System Information Is Unavailable At This Time", vbOKOnly
  313. End Sub
  314.  
  315. Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean
  316.     Dim i As Long                                           ' Loop Counter
  317.     Dim rc As Long                                          ' Return Code
  318.     Dim hKey As Long                                        ' Handle To An Open Registry Key
  319.     Dim hDepth As Long                                      '
  320.     Dim KeyValType As Long                                  ' Data Type Of A Registry Key
  321.     Dim tmpVal As String                                    ' Tempory Storage For A Registry Key Value
  322.     Dim KeyValSize As Long                                  ' Size Of Registry Key Variable
  323.     '------------------------------------------------------------
  324.     ' Open RegKey Under KeyRoot {HKEY_LOCAL_MACHINE...}
  325.     '------------------------------------------------------------
  326.     rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) ' Open Registry Key
  327.     
  328.     If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError          ' Handle Error...
  329.     
  330.     tmpVal = String$(1024, 0)                             ' Allocate Variable Space
  331.     KeyValSize = 1024                                       ' Mark Variable Size
  332.     
  333.     '------------------------------------------------------------
  334.     ' Retrieve Registry Key Value...
  335.     '------------------------------------------------------------
  336.     rc = RegQueryValueEx(hKey, SubKeyRef, 0, _
  337.                          KeyValType, tmpVal, KeyValSize)    ' Get/Create Key Value
  338.                         
  339.     If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError          ' Handle Errors
  340.     
  341.     If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then           ' Win95 Adds Null Terminated String...
  342.         tmpVal = Left(tmpVal, KeyValSize - 1)               ' Null Found, Extract From String
  343.     Else                                                    ' WinNT Does NOT Null Terminate String...
  344.         tmpVal = Left(tmpVal, KeyValSize)                   ' Null Not Found, Extract String Only
  345.     End If
  346.     '------------------------------------------------------------
  347.     ' Determine Key Value Type For Conversion...
  348.     '------------------------------------------------------------
  349.     Select Case KeyValType                                  ' Search Data Types...
  350.     Case REG_SZ                                             ' String Registry Key Data Type
  351.         KeyVal = tmpVal                                     ' Copy String Value
  352.     Case REG_DWORD                                          ' Double Word Registry Key Data Type
  353.         For i = Len(tmpVal) To 1 Step -1                    ' Convert Each Bit
  354.             KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1)))   ' Build Value Char. By Char.
  355.         Next
  356.         KeyVal = Format$("&h" + KeyVal)                     ' Convert Double Word To String
  357.     End Select
  358.     
  359.     GetKeyValue = True                                      ' Return Success
  360.     rc = RegCloseKey(hKey)                                  ' Close Registry Key
  361.     Exit Function                                           ' Exit
  362.     
  363. GetKeyError:      ' Cleanup After An Error Has Occured...
  364.     KeyVal = ""                                             ' Set Return Val To Empty String
  365.     GetKeyValue = False                                     ' Return Failure
  366.     rc = RegCloseKey(hKey)                                  ' Close Registry Key
  367. End Function
  368.  
  369.