Das Notes Forum

Domino 9 und frühere Versionen => Administration & Userprobleme => Thema gestartet von: mastertom am 31.07.03 - 12:03:19

Titel: Notes-Verzeichnis ermitteln
Beitrag von: mastertom am 31.07.03 - 12:03:19
Hi Leute,

wie ermittele ich, in welchem Verzeichnis die Notes-Exe-Dateien (und der ganze Rest) stehen.

Das Data-Verzeichis ist aus der Ini auszulesen, aber kann ich mit Notes-Mitteln auch den Installationspfad auf dem Rechner ermitteln?

Titel: Re:Notes-Verzeichnis ermitteln
Beitrag von: Axel am 31.07.03 - 12:09:28
Hi,

meines Erachtens ist der einzigste Weg das Programmverzeichnis zu ermitteln, die Registry auszulesen.

Ich hab vor einiger Zeit mal was im Web gefunden:

Zitat
How to retrieve values from your system's registry

Here's an example of how to retrieve values from your system's registry. The first part is a generic LotusScript function
that retrieves just about any value you request. The last two parts are examples of how to use the function to retrieve
the computer name and Notes path from the registry.

(Declarations)
Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const HKEY_USERS = &H80000003
Public Const HKEY_CURRENT_CONFIG = &H80000005
Public Const HKEY_DYN_DATA = &H80000006
Public Const REG_SZ = 1 ' Unicode null-terminated string
Public Const REG_BINARY = 3 ' Free form binary
Public Const REG_DWORD = 4 ' 32-bit number
Public Const ERROR_SUCCESS = 0&
Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (Byval hKey As Long, _
                             Byval lpSubKey As String, phkResult As Long) As Long
Declare Function RegCloseKey Lib "advapi32.dll" (Byval hKey As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (Byval hKey As Long, _
                             Byval lpValueName As String, Byval lpReserved As Long, lpType As Long, _
                             lpData As Any, lpcbData As Long) As Long

Function GetSettingString(hKey As Long, strPath As String, strValue As String) As String
Dim hCurKey As Long
Dim lResult As Long
Dim lValueType As Long
Dim strBuffer As String
Dim lDataBufferSize As Long
Dim intZeroPos As Integer
Dim lRegResult As Long
GetSettingString = ""
lRegResult = RegOpenKey(hKey, strPath, hCurKey)
lRegResult = RegQueryValueEx(hCurKey, strValue, 0&, lValueType, Byval 0&, lDataBufferSize)
If lRegResult = ERROR_SUCCESS Then
If lValueType = REG_SZ Then
strBuffer = String(lDataBufferSize, " ")
lResult = RegQueryValueEx(hCurKey, strValue, 0&, 0&, Byval strBuffer,
lDataBufferSize)
intZeroPos = Instr(strBuffer, Chr$(0))
If intZeroPos > 0 Then
GetSettingString = Left$(strBuffer, intZeroPos - 1)
Else
GetSettingString = strBuffer
End If
End If
Else
' there is a problem
End If
lRegResult = RegCloseKey(hCurKey)
End Function

This subroutine shows how to retrieve the computer name from the registry.

Sub Initialize
Dim ComputerName As String
ComputerName=GetSettingString( HKEY_LOCAL_MACHINE, _
"System\CurrentControlSet\Control\ComputerName\ComputerName", _
"ComputerName")
Messagebox ComputerName,,"The ComputerName is"
End Sub

This subroutine shows how to retrieve the Notes program directory.
You'll need to indicate your Notes version.

Sub Initialize
Dim NotesProgramPath As String
NotesProgramPath=GetSettingString( HKEY_LOCAL_MACHINE, _
"Software\Lotus\Notes\5.0", _
"Path")
Messagebox NotesProgramPath,,"The Path to Notes Program is"
End Sub


Axel
Titel: Re:Notes-Verzeichnis ermitteln
Beitrag von: eknori am 31.07.03 - 12:50:40
yoo, auch net.

Hier die Lösung über Notes API

Option Declare

Const W_API_MODULE = "nnotes"

Declare Sub subwOSGetExecutableDirectory Lib W_API_MODULE Alias "OSGetExecutableDirectory" _
(Byval v_strRetPathName As String)


Sub Click(Source As Button)
   Dim strFullDir As String
   strFullDir = String$(127,0)
   Call subwOSGetExecutableDirectory(strFullDir)   
   Messagebox strFullDir, 4160, "Notes Executable Directory"
End Sub
Titel: Re:Notes-Verzeichnis ermitteln
Beitrag von: mastertom am 31.07.03 - 15:32:17
Ich bin begeistert... beide Versionen funktionieren!

Super Ansätze und prompte Lösung :-)

Das ist, warum ich das Board so schätze  :)

1000 Dank!
Titel: Re:Notes-Verzeichnis ermitteln
Beitrag von: Jörg P. am 01.08.03 - 12:01:18
Hi,

Prob ist zwar schon erledigt, aber ich wollt' euch folgendes kleines Tool nicht vorenthalten:

NotePath
Version: 1.0
File Date: 8-18-02
Licensing: Freeware
NotePath is a command-line tool to determine the path for the Notes executable directory, the Notes data directory, and the Notes INI file on the local machine. It also shows the version of Notes found in the Notes executable directory. It first attempts to find the Notes DLLs from the current directory, then from the PATH, and then from the registry.
Requirements
Windows 95/98/NT/2000
Lotus Notes Client 4.6 or higher

Notepath.txt in Notepath.exe umbenennen !

Ach ja, das ganze hab' ich mal in der Sandbox gefunden, glaub' ich.
Titel: Re: Notes-Verzeichnis ermitteln
Beitrag von: Mandalor am 14.01.05 - 17:00:57
Danke mir hat das auch geholfen, aber wenn ich an den String etwas dranhängen will, das ändert er sich nicht:

StrFulldir = StrFulldir & "notes.exe"

oder

StrFulldir = StrFulldir + "notes.exe"

Ausgabe: "D:\notes\"

wie kann ich das ändern?
Titel: Re: Notes-Verzeichnis ermitteln
Beitrag von: -Michael- am 14.01.05 - 19:36:42
Hi Mandalor,

Du verwendest da wohl die NotesAPI-Lösung von Eknori.

Nun, es liegt da IMHO an
Zitat
strFullDir = String$(127,0)

Dies definiert die Länge von 127, und der Rest nach dem Pfad sind dann lauter Chr(0)-er - bis eben die 127 voll sind.

Abhilfe auf die Schnelle:
Code
strFullDir = Strleft(strFullDir, Chr(0)) & "notes.exe"

Besser wäre es wohl, sich hier mit der NotesAPI tiefgreifender auseinanderzusetzen, und zu verstehen, was da passiert. Du kannst Dir hierzu mal folgende Links ansehen: C API Links (http://www.notes-links.de/cpo/dokus/index.php?PHPSESSID=da56979988b1fc4db18520ae72510a4c&PHPSESSID=89fd469113b8d9deee3d0f4f21bfc3e4#612)


Michael