My code comes from another of my App's ... some code not working in my new app.s is as follows:
Global Const RegODEkey = "Software\Optimal Designs Enterprise\" & ProgramName
ooo
' Set 'tPause' value in Registry
If CheckRegistryKey(HKEY_CURRENT_USER, RegODEkey) = False Then
CreateRegistryKey HKEY_CURRENT_USER, RegODEkey
' SetRegistryValue HKEY_CURRENT_USER, RegODEkey, "tPause", REG_SZ, "20" ... seems ok to start/compile!
SetRegistryValue RegODEkey, "tPause", tPause.Text
End If
tPause.Text = GetRegistryValue(RegODEkey, "tPause", REG_SZ)
If tPause.Text = "" Then tPause = "20"
ooo
' Write / Create a Registry value.
' Use KeyName = "" for the default value.
' Supports only DWORD, SZ, and BINARY value types.
Sub SetRegistryValue(ByVal hKey As Long, ByVal KeyName As String, ByVal ValueName As String, ByVal KeyType As Integer, value As Variant)
Dim handle As Long, lngValue As Long
Dim strValue As String
Dim binValue() As Byte, length As Long
' Open the key, exit if not found.
If mdlRegistryAPI.RegOpenKeyEx(hKey, KeyName, 0, KEY_WRITE, handle) Then Exit Sub
Select Case KeyType
Case REG_DWORD
lngValue = value
RegSetValueEx handle, ValueName, 0, KeyType, lngValue, 4
Case REG_SZ
strValue = value
RegSetValueEx handle, ValueName, 0, KeyType, ByVal strValue, Len(strValue)
Case REG_BINARY
binValue = value
length = UBound(binValue) - LBound(binValue) + 1
RegSetValueEx handle, ValueName, 0, KeyType, binValue(LBound(binValue)), length
End Select
' Close the key.
RegCloseKey handle
End Sub
Ideas where my problem is? My app can be downloaded at goal-driven.net/download/ and choose "Match-n-Freq (v. 6.6) ... 4 mB" ... its free and has VB6 source code with it.