Hi,
I wish to run a vb app which queries the registry and returns a result. I then want to use that result to set a variable value which I can use in DOS. A batch file runs the vb app, when the vb app has finished a variable has been set.
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegQueryValueEx 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 Const REG_SZ = 1
Dim nBufferKey As Long
Dim nBufferName As String
Private Const LOCALMACHINE = &H80000002
nBufferName = Space(4)
RegOpenKey LOCALMACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion", nBufferKey
RegQueryValueEx nBufferKey, "CurrentVersion", 0, REG_SZ, nBufferName, Len(nBufferName)
RegCloseKey nBufferKey
nBufferName = Left(nBufferName, 3)
Select Case nBufferName
Case 4.0
SET a variable to NT
case 5.0
SET a variable to 2000
case 5.1
SET a variable to XP
end select
Thanks