You need to read/write to the registry using the win32 API. You then have
the freedom you need. I'll provide some pointers, but you would be further
ahead to query microsofts knowledge base for this type of issue.
Brad
Option Explicit
Global vValue As Variant 'setting of queried value
Const REG_SZ As Long = 1
Const REG_DWORD As Long = 4
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const ERROR_NONE = 0
Const ERROR_BADDB = 1
Const ERROR_BADKEY = 2
Const ERROR_CANTOPEN = 3
Const ERROR_CANTREAD = 4
Const ERROR_CANTWRITE = 5
Const ERROR_OUTOFMEMORY = 6
Const ERROR_ARENA_TRASHED = 7
Const ERROR_ACCESS_DENIED = 8
Const ERROR_INVALID_PARAMETERS = 87
Const ERROR_NO_MORE_ITEMS = 259
Const KEY_ALL_ACCESS = &H3F
Const REG_OPTION_NON_VOLATILE = 0
Const FRENCH_LOCALE = "00000C0C"
Const ENGLISH_US = "00000409"
Const ENGLISH_CANADA = "00001009"
Global Const MBXPATH = "D:\ORCA\" 'mar15
Public iStartColNumber As Integer
Public iNumRows As Integer
Public iWeightRow As Integer
Public iStartRowNumber As Integer
Public vMapInfoDATAArray() As Variant
Public sColumnames(10) As String
Public iNumColsToMap As Integer
Private Declare Function RegCloseKey Lib "advapi32.dll" _
(ByVal hKey As Long) As Long
Private Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias _
"RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, _
ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions _
As Long, ByVal samDesired As Long, ByVal lpSecurityAttributes _
As Long, phkResult As Long, lpdwDisposition As Long) As Long
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias _
"RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, _
ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As _
Long) As Long
Private Declare Function RegQueryValueExString Lib "advapi32.dll" Alias _
"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As _
String, ByVal lpReserved As Long, lpType As Long, ByVal lpData _
As String, lpcbData As Long) As Long
Private Declare Function RegQueryValueExLong Lib "advapi32.dll" Alias _
"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As _
String, ByVal lpReserved As Long, lpType As Long, lpData As _
Long, lpcbData As Long) As Long
Private Declare Function RegQueryValueExNULL Lib "advapi32.dll" Alias _
"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As _
String, ByVal lpReserved As Long, lpType As Long, ByVal lpData _
As Long, lpcbData As Long) As Long
Private Declare Function RegSetValueExString Lib "advapi32.dll" Alias _
"RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, _
ByVal Reserved As Long, ByVal dwType As Long, ByVal lpValue As _
String, ByVal cbData As Long) As Long
Private Declare Function RegSetValueExLong Lib "advapi32.dll" Alias _
"RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, _
ByVal Reserved As Long, ByVal dwType As Long, lpValue As Long, _
ByVal cbData As Long) As Long
'Registry query function: SetValueEx and QueryValueEx Wrapper Functions
Public Function SetValueEx(ByVal hKey As Long, sValueName As String, _
lType As Long, vValue As Variant) As Long
Dim lValue As Long
Dim sValue As String
Select Case lType
Case REG_SZ
sValue = vValue & Chr$(0)
SetValueEx = RegSetValueExString(hKey, sValueName, 0&, _
lType, sValue, Len(sValue))
Case REG_DWORD
lValue = vValue
SetValueEx = RegSetValueExLong(hKey, sValueName, 0&, _
lType, lValue, 4)
End Select
End Function
'Registry query function
Public Function QueryValueEx(ByVal lhKey As Long, ByVal szValueName As _
String, vValue As Variant) As Long
Dim cch As Long
Dim lrc As Long
Dim lType As Long
Dim lValue As Long
Dim sValue As String
On Error GoTo QueryValueExError
' Determine the size and type of data to be read
lrc = RegQueryValueExNULL(lhKey, szValueName, 0&, lType, 0&, cch)
If lrc <> ERROR_NONE Then Error 5
Select Case lType
' For strings
Case REG_SZ:
sValue = String(cch, 0)
lrc = RegQueryValueExString(lhKey, szValueName, 0&, lType, _
sValue, cch)
If lrc = ERROR_NONE Then
vValue = Left$(sValue, cch - 1)
Else
vValue = Empty
End If
' For DWORDS
Case REG_DWORD:
lrc = RegQueryValueExLong(lhKey, szValueName, 0&, lType, _
lValue, cch)
If lrc = ERROR_NONE Then vValue = lValue
Case Else
'all other data types not supported
lrc = -1
End Select
QueryValueExExit:
QueryValueEx = lrc
Exit Function
QueryValueExError:
Resume QueryValueExExit
End Function
'Registry query of locale
Public Sub QueryValue(sKeyName As String, sValueName As String)
Dim lRetVal As Long 'result of the API functions
Dim hKey As Long 'handle of opened key
' Dim vValue As Variant 'setting of queried value
lRetVal = RegOpenKeyEx(HKEY_CURRENT_USER, sKeyName, 0, _
KEY_ALL_ACCESS, hKey)
lRetVal = QueryValueEx(hKey, sValueName, vValue)
' testing of registry values
' Select Case vValue
' Case FRENCH_LOCALE
' MsgBox "French Canadian"
' Case ENGLISH_US
' MsgBox "English US"
' Case ENGLISH_CANADA
' MsgBox "English Canadian"
' Case Else
' MsgBox vValue
' End Select
RegCloseKey (hKey)
End Sub
Public Sub QueryMapInfo(sKeyName As String, sValueName As String)
Dim lRetVal As Long 'result of the API functions
Dim hKey As Long 'handle of opened key
lRetVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, sKeyName, 0, _
KEY_ALL_ACCESS, hKey)
lRetVal = QueryValueEx(hKey, sValueName, vValue)
RegCloseKey (hKey)
End Sub
Sub MapInfoLocation()
MBXPATH = "c:\pathtoyourmbxprogram\"
On Error GoTo NotFound
'find where mapinfo is residing
QueryMapInfo "Software\Microsoft\Windows\CurrentVersion\App
Paths\mapinfow.exe", "Path"
Dim PathString As String
PathString = vValue & "\mapinfow.exe " & MBXPATH & "yourmbxprogram.mbx
/nosplash"
'MsgBox PathString
Dim RetVal
RetVal = Shell(PathString, 4)
' On Error GoTo StartExcel nov29
'AppActivate "Microsoft Excel"
'Application.Caption = "Orca"
Exit Sub
NotFound:
MsgBox "Please ensure that ""orca.mbx"" is running."
Exit Sub
'StartExcel: nov29
' Application.Caption = "ORCA" nov29
' Exit Sub nov29
End Sub
At 11:38 AM 6/11/99 +0700, you wrote:
>Hello ALL...,
>
>From what I have done:
>
> -: savesetting (to save) and
> -: getsetting (to read)
>
>these are the result in the root
> -> HKEY_CURRENT_USER\Software\VB and VBA Program Setting\MyDev\Path
> key = "C:\"
>
>My concern is if this application has been compiled and installed in any pc
>that has no VB6 - it won't work - since we would likely need to install in
>several pc station.
>
>What I need is:
>
> -> HKEY_LOCAL_MACHINE\Software\MyDev\path
> key = "C:\"
>so I do not need to be dependent to the VB6 exixtence and with this command
>I will be able to change the key register of an application program that has
>been registered in the root - HKEY_LOCAL_MACHINE\Software
>
>How could I save and read the register from VB6?
>
>TIA
>Ara Budidarma
>
>
>-----Original Message-----
>From: Emmanuel Par� <[EMAIL PROTECTED]>
>To: G E O I N F O <[EMAIL PROTECTED]>
>Date: Wednesday, June 09, 1999 7:06 PM
>Subject: Re: MI VB6
>
>
>>Hi,
>>
>> Take a look at the Visual Basic Help ... here is a snippet of the help
>>Keywords are GetSetting, and SaveSetting
>>
>>Returns a key setting value from an application's entry in the Windows
>>registry.
>>
>>Syntax
>>
>>GetSetting(appname, section, key[, default])
>>
>>The GetSetting function syntax has these named arguments:
>>
>>Part Description
>>appname Required. String expression containing the name of the application
>>or project whose key setting is requested.
>>section Required. String expression containing the name of the section
>where
>>the key setting is found.
>>key Required. String expression containing the name of the key setting to
>>return.
>>default Optional. Expression containing the value to return if no value is
>>set in the key setting. If omitted, default is assumed to be a zero-length
>>string ("").
>>Remarks
>>
>>If any of the items named in the GetSetting arguments do not exist,
>>GetSetting returns the value of default.
>>
>>
>>-----Original Message-----
>>From: G E O I N F O <[EMAIL PROTECTED]>
>>To: Mapinfo-l <[EMAIL PROTECTED]>
>>Date: 9 juin, 1999 03:58
>>Subject: MI VB6
>>
>>
>>>Hello listers,
>>>
>>>This is my first time developing map based application using MapX 3.5 and
>>>VB6.
>>>
>>>1. Please do help me how to input a code into windows sysreg from the VB
>>> on my own defined root - for example:
>>>
>>> root -> HKEY_LOCAL_MACHINE\Software\MyDev\path
>>> code -> "c:\" type "string"
>>>
>>>2. How could I read the data that has been entered in the windows sysreg
>>>from my
>>> application?
>>>
>>>Thanking you in advance.
>>>
>>>Regards,
>>>Ara Budidarma - GIS Programmer
>>>PT. GEONUSA INFOTAMA (GEOINFO)
>>>Tel. 62-21-8200167; Fax. 021-82405373
>>>
>>>
>>>----------------------------------------------------------------------
>>>To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
>>>"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
>>>
>>
>
>
>----------------------------------------------------------------------
>To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
>"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
>
GeoInfo Solutions Ltd.
mailto:[EMAIL PROTECTED]
http://www.geoinfosolutions.com
phone/fax 250-656-7170
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]