home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hot Shareware 35
/
hot35.iso
/
ficheros
/
LVB
/
T2W32543.ZIP
/
_REGISTR.FRM
< prev
next >
Wrap
Text File
|
1998-05-21
|
15KB
|
367 lines
VERSION 5.00
Begin VB.Form frmRegistry
BorderStyle = 4 'Fixed ToolWindow
Caption = "Registry"
ClientHeight = 4845
ClientLeft = 1890
ClientTop = 3270
ClientWidth = 7485
MaxButton = 0 'False
MDIChild = -1 'True
PaletteMode = 1 'UseZOrder
ScaleHeight = 4845
ScaleWidth = 7485
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Height = 570
Left = 0
TabIndex = 1
Top = -90
Width = 7485
Begin VB.CommandButton cmdNP
Caption = ">"
Height = 285
Index = 1
Left = 7110
TabIndex = 6
Top = 195
Width = 285
End
Begin VB.CommandButton cmdNP
Caption = "<"
Height = 285
Index = 0
Left = 6210
TabIndex = 5
Top = 195
Width = 285
End
Begin VB.CommandButton Command1
Caption = "&Go"
Default = -1 'True
Height = 285
Left = 6570
TabIndex = 4
Top = 195
Width = 465
End
Begin VB.ComboBox cmb_Function
Height = 315
Left = 1365
TabIndex = 2
Top = 180
Width = 4755
End
Begin VB.Label Label2
Caption = "&Select a function"
Height = 255
Left = 90
TabIndex = 3
Top = 210
Width = 1275
End
End
Begin VB.TextBox txt_Result
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
Height = 4110
Left = 105
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 630
Width = 7260
End
End
Attribute VB_Name = "frmRegistry"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Private Const Iteration = 250
Dim IsLoaded As Integer
Dim TimerStartOk As Integer
Dim TimerCloseOk As Integer
Dim TimerHandle As Integer
Dim TimerValue As Long
Private Sub cmdNP_Click(Index As Integer)
Call sub_NextPrev(cmb_Function, Index)
End Sub
Private Sub cmb_Function_Click()
If (IsLoaded = False) Then Exit Sub
Call cDisableFI(mdiT2W.Picture1)
txt_Result = ""
DoEvents
Select Case cmb_Function.ListIndex
Case 0
Call TestRegistry
Case 1
Call TestRegistryExt
Case 2
Call TestGetAllSettings
End Select
DoEvents
Call cEnableFI(mdiT2W.Picture1)
End Sub
Private Sub Form_Activate()
mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
End Sub
Private Sub Form_Load()
IsLoaded = False
Show
Call sub_Load_Combo(cmb_Function, T2WDirInst + "_registr.t2w")
IsLoaded = True
End Sub
Private Sub Command1_Click()
Call cmb_Function_Click
End Sub
Private Sub TestRegistry()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim Section1 As String
Dim Section2 As String
Dim i As Integer
Dim RKI As tagREGISTRYKEYINFO
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "HKEY_CURRENT_USER" & vbCrLf & vbCrLf
Section1 = "under the fox"
Section2 = "software\The MCR Company\TIME TO WIN for VB 4.0"
strDisplay = strDisplay & "Use section '" & Section1 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Setting default value to 'no key' is '" & cPutRegistry(Section1, "", "no key") & "'" & vbCrLf
strDisplay = strDisplay & "Setting value of key 'key1' to 'test key 1' is '" & cPutRegistry(Section1, "key1", "test key 1") & "'" & vbCrLf
strDisplay = strDisplay & "Setting value of key 'key2' to 'test key 2' is '" & cPutRegistry(Section1, "key2", "test key 2") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Getting default value is '" & cGetRegistry(Section1, "", "?") & "'" & vbCrLf
strDisplay = strDisplay & "Getting value of key 'key2' is '" & cGetRegistry(Section1, "key2", "?") & "'" & vbCrLf
strDisplay = strDisplay & "Getting value of key 'key1' is '" & cGetRegistry(Section1, "key1", "?") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Key information is '" & cRegistryKeyInfo(Section1, RKI) & "'" & vbCrLf
strDisplay = strDisplay & " SubKeys = " & RKI.lSubKeys & vbCrLf
strDisplay = strDisplay & " MaxSubKeyLen = " & RKI.lMaxSubKeyLen & vbCrLf
strDisplay = strDisplay & " Values = " & RKI.lValues & vbCrLf
strDisplay = strDisplay & " MaxValueNameLen = " & RKI.lMaxValueNameLen & vbCrLf
strDisplay = strDisplay & " MaxValueLen = " & RKI.lMaxValueLen & vbCrLf
strDisplay = strDisplay & " InfoInStr = " & RKI.sInfoInStr & vbCrLf & vbCrLf
strDisplay = strDisplay & "Use section '" & Section2 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Setting default value to 'License information' is '" & cPutRegistry(Section2, "", "License information") & "'" & vbCrLf
strDisplay = strDisplay & "Setting value of key 'Name' to 'James' is '" & cPutRegistry(Section2, "Name", "James") & "'" & vbCrLf
strDisplay = strDisplay & "Setting value of key 'Id' to 'Donb' is '" & cPutRegistry(Section2, "Id", "Donb") & "'" & vbCrLf
strDisplay = strDisplay & "Setting value of key 'N░' to '007' is '" & cPutRegistry(Section2, "N░", "007") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Getting default value is '" & cGetRegistry(Section2, "", "?") & "'" & vbCrLf
strDisplay = strDisplay & "Getting value of key 'Name' is '" & cGetRegistry(Section2, "Name", "?") & "'" & vbCrLf
strDisplay = strDisplay & "Getting value of key 'Id' is '" & cGetRegistry(Section2, "Id", "?") & "'" & vbCrLf
strDisplay = strDisplay & "Getting value of key 'N░' is '" & cGetRegistry(Section2, "N░", "?") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Key information is '" & cRegistryKeyInfo(Section2, RKI) & "'" & vbCrLf
strDisplay = strDisplay & " SubKeys = " & RKI.lSubKeys & vbCrLf
strDisplay = strDisplay & " MaxSubKeyLen = " & RKI.lMaxSubKeyLen & vbCrLf
strDisplay = strDisplay & " Values = " & RKI.lValues & vbCrLf
strDisplay = strDisplay & " MaxValueNameLen = " & RKI.lMaxValueNameLen & vbCrLf
strDisplay = strDisplay & " MaxValueLen = " & RKI.lMaxValueLen & vbCrLf
strDisplay = strDisplay & " InfoInStr = " & RKI.sInfoInStr & vbCrLf & vbCrLf
strDisplay = strDisplay & "Kill Section 'under the fox' is '" & cKillRegistry(Section1, "") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Kill Section 'software\The MCR Company' is '" & cKillRegistry("software\The MCR Company", "") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Kill Section 'software\The MCR Company\TIME TO WIN for VB 4.0' is '" & cKillRegistry("software\The MCR Company\TIME TO WIN for VB 4.0", "") & "'" & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
intResult = cPutRegistry(Section2, "Name", "James")
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cGetRegistry(Section2, "", "?1")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
intResult = cKillRegistry("software\The MCR Company", "")
End Sub
Private Sub TestRegistryExt()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim Section1 As String
Dim Section2 As String
Dim i As Integer
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "HKEY_LOCAL_MACHINE" & vbCrLf & vbCrLf
strDisplay = strDisplay & " (" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, "HARDWARE\DESCRIPTION\System\CentralProcessor\0", "Identifier", "?") & ")" & vbCrLf
strDisplay = strDisplay & " (" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, "HARDWARE\DESCRIPTION\System\CentralProcessor\0", "VendorIdentifier", "?") & ")" & vbCrLf & vbCrLf
Section1 = "under the fox"
Section2 = "software\The MCR Company\TIME TO WIN for VB 4.0"
strDisplay = strDisplay & "Use section '" & Section1 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Setting default value to 'no key' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "", "no key") & "'" & vbCrLf
strDisplay = strDisplay & "Setting value of key 'key1' to 'test key 1' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "key1", "test key 1") & "'" & vbCrLf
strDisplay = strDisplay & "Setting value of key 'key2' to 'test key 2' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "key2", "test key 2") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Getting default value is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "", "?") & "'" & vbCrLf
strDisplay = strDisplay & "Getting value of key 'key2' is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "key2", "?") & "'" & vbCrLf
strDisplay = strDisplay & "Getting value of key 'key1' is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "key1", "?") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Use section '" & Section2 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Setting default value to 'License information' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "", "License information") & "'" & vbCrLf
strDisplay = strDisplay & "Setting value of key 'Name' to 'James' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "Name", "James") & "'" & vbCrLf
strDisplay = strDisplay & "Setting value of key 'Id' to 'Donb' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "Id", "Donb") & "'" & vbCrLf
strDisplay = strDisplay & "Setting value of key 'N░' to '007' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "N░", "007") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Getting default value is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "", "?") & "'" & vbCrLf
strDisplay = strDisplay & "Getting value of key 'Name' is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "Name", "?") & "'" & vbCrLf
strDisplay = strDisplay & "Getting value of key 'Id' is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "Id", "?") & "'" & vbCrLf
strDisplay = strDisplay & "Getting value of key 'N░' is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "N░", "?") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Kill Section 'under the fox' is '" & cKillRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Kill Section 'software\The MCR Company' is '" & cKillRegistryExt(RK_HKEY_LOCAL_MACHINE, "software\The MCR Company", "") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Kill Section 'software\The MCR Company\TIME TO WIN for VB 4.0' is '" & cKillRegistryExt(RK_HKEY_LOCAL_MACHINE, "software\The MCR Company\TIME TO WIN for VB 4.0", "") & "'" & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
intResult = cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "Name", "James")
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "", "?1")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
intResult = cKillRegistryExt(RK_HKEY_LOCAL_MACHINE, "software\The MCR Company", "")
End Sub
Private Sub TestGetAllSettings()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim Section1 As String
Dim Section2 As String
Dim i As Integer
Dim RKI As tagREGISTRYKEYINFO
SaveSetting "MyApp", "TestGetAllSettings", "Product", "TIME TO WIN 32-Bit"
SaveSetting "MyApp", "TestGetAllSettings", "Top", 75
SaveSetting "MyApp", "TestGetAllSettings", "Left", 50
SaveSetting "MyApp", "TestGetAllSettings", "Version", cGetVersion()
SaveSetting "MyApp", "TestGetAllSettings", "IsRegistered", cIsRegistered()
strResult = ""
strDisplay = ""
Section1 = "Software\VB and VBA Program Settings\MyApp\TestGetAllSettings"
strDisplay = strDisplay & "Section is " & vbCrLf
strDisplay = strDisplay & " " & Section1 & vbCrLf & vbCrLf
strDisplay = strDisplay & "Key information is '" & cRegistryKeyInfo(Section1, RKI) & "'" & vbCrLf
strDisplay = strDisplay & " SubKeys = " & RKI.lSubKeys & vbCrLf
strDisplay = strDisplay & " MaxSubKeyLen = " & RKI.lMaxSubKeyLen & vbCrLf
strDisplay = strDisplay & " Values = " & RKI.lValues & vbCrLf
strDisplay = strDisplay & " MaxValueNameLen = " & RKI.lMaxValueNameLen & vbCrLf
strDisplay = strDisplay & " MaxValueLen = " & RKI.lMaxValueLen & vbCrLf
strDisplay = strDisplay & " InfoInStr = " & RKI.sInfoInStr & vbCrLf & vbCrLf
ReDim Strarray(1 To (RKI.lValues + 1), 1 To 2) As String
strDisplay = strDisplay & "Number of values is " & cGetAllSettings(Strarray(), Section1) & vbCrLf & vbCrLf
For i = 1 To RKI.lValues
strDisplay = strDisplay & " " & Strarray(i, 1) & " = " & Strarray(i, 2) & vbCrLf
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cGetAllSettings(Strarray(), Section1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
intResult = cKillRegistry(Section1, "")
End Sub