LSM 710 and LSM 780
MACROS AND VISUAL BASIC
Systems
VBA PROGRAMMING FOR LSM
Carl Zeiss
02/2010 M60-1-0025
e
37
Function FServerFromDescription(strName As String, strPath As String) As Boolean
Dim lngResult As Long
Dim strTmp As String
Dim hKeyServer As Long
Dim strBuffer As String
Dim cb As Long
Dim i As Integer
FServerFromDescription = False
strTmp = VBA.Space(255)
strTmp = s "\CLSID"
lngResult = RegOpenKeyEx(HKEY_CLASSES_ROOT, strTmp, 0&, KEY_READ, hKeyServer)
If (Not lngResult = ERROR_SUCCESS) Then GoTo error_exit
strBuffer = VBA.Space(255)
cb = Len(strBuffer)
lngResult = RegQueryValueEx(hKeyServer, "", 0&, REG_SZ, ByVal strBuffer, cb)
If (Not lngResult = ERROR_SUCCESS) Then GoTo error_exit
lngResult = RegCloseKey(hKeyServer)
strTmp = VBA.Space(255)
strTmp = "CLSID\" + Left(strBuffer, cb - 1) + "\LocalServer32"
strBuffer = VBA.Space(255)
cb = Len(strBuffer)
lngResult = RegOpenKeyEx(HKEY_CLASSES_ROOT, strTmp, 0&, KEY_READ, hKeyServer)
If (Not lngResult = ERROR_SUCCESS) Then GoTo error_exit
lngResult = RegQueryValueEx(hKeyServer, "", 0&, REG_SZ, ByVal strBuffer, cb)
If (Not lngResult = ERROR_SUCCESS) Then GoTo error_exit
strPath = Left(strBuffer, cb - 1)