Post by Peter OstermannHallo Karsten,
genau darum geht es. :) Offensichtlich gehörst Du zu den "kundigen"
Programmieren?!
Es gibt sicherlich viele, die mehr wissen als ich, aber noch mehr Leute gibt
es, die andere nicht an dem Wissen teilhaben lassen :-)
Post by Peter OstermannProblemlos unter XP schreibt das Programm, um das es geht, Einträge in die
Registry. Das ist in diesem Fall unabdingbar. Wie kann ich "Vista"
anwiesen: "Tue das unabhängig von der Administrator Berechtigung" Oder wie
kann ich beim Eintragen die Berechtigung "mitgeben"?
Ich habe mir da in einem Programm mal die Mühe gemacht, über API-Aufrufe mir
entsprechende Verzeichnisse zu "besorgen".
Ich hoffe, die paar Zeilen helfen Dir weiter :-)
HTH, Karsten
---- Start Quelltext -----
Private Declare Function GetTempPath Lib "kernel32" Alias _
"GetTempPathA" (ByVal nBufferLength As Long, ByVal _
lpBuffer As String) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal _
pszPath As String) As Long
Private Declare Function SHGetSpecialFolderLocation Lib _
"shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder _
As Long, pidl As ITEMIDLIST) As Long
' Desktop
Public Const CSIDL_COMMON_DESKTOPDIRECTORY As Long = &H19
Public Const CSIDL_COMMON_DOCUMENTS As Long = &H2E
' Favoriten
Public Const CSIDL_COMMON_FAVORITES As Long = &H1F
' Gemeinsame Musik
Public Const CSIDL_COMMON_MUSIC As Long = &H35
' Gemeinsame Bilder
Public Const CSIDL_COMMON_PICTURES As Long = &H36
' Programme-Ordner im Startmenü
Public Const CSIDL_COMMON_PROGRAMS As Long = &H17
' Starmenü
Public Const CSIDL_COMMON_STARTMENU As Long = &H16
' Autostart
Public Const CSIDL_COMMON_STARTUP As Long = &H18
' Vorlagen
Public Const CSIDL_COMMON_TEMPLATES As Long = &H2D
' Gemeinsame Videos
Public Const CSIDL_COMMON_VIDEO As Long = &H37
Public Const CSIDL_CONTROLS As Long = &H3
' Cookies
Public Const CSIDL_COOKIES As Long = &H21
' Desktop
Public Const CSIDL_DESKTOP As Long = &H0
Public Const CSIDL_DESKTOPDIRECTORY As Long = &H10
' Treiber
Public Const CSIDL_DRIVES As Long = &H11
' Favoriten
Public Const CSIDL_FAVORITES As Long = &H6
' Schriftarten
Public Const CSIDL_FONTS As Long = &H14
' Verlauf
Public Const CSIDL_HISTORY As Long = &H22
Public Const CSIDL_INTERNET As Long = &H1
' Temporäre Internetdateien
Public Const CSIDL_INTERNET_CACHE As Long = &H20
' Anwendungsdaten
Public Const CSIDL_LOCAL_APPDATA As Long = &H1C
Public Const CSIDL_MYDOCUMENTS As Long = &HC
' Eigene Musik
Public Const CSIDL_MYMUSIC As Long = &HD
' Eigene Bilder
Public Const CSIDL_MYPICTURES As Long = &H27
' Eigene Videos
Public Const CSIDL_MYVIDEO As Long = &HE
' Netzwerkumgebung
Public Const CSIDL_NETHOOD As Long = &H13
Public Const CSIDL_NETWORK As Long = &H12
' Eigene Dateien
Public Const CSIDL_PERSONAL As Long = &H5
Public Const CSIDL_PRINTERS As Long = &H4
' Druckerumgebung
Public Const CSIDL_PRINTHOOD As Long = &H1B
' Profil
Public Const CSIDL_PROFILE As Long = &H28
' Programme
Public Const CSIDL_PROGRAM_FILES As Long = &H26
' Gemeinsamme Dateien
Public Const CSIDL_PROGRAM_FILES_COMMON As Long = &H2B
' Programme (im Startmenü)
Public Const CSIDL_PROGRAMS As Long = &H2
' Zuletzt verwendete Dokumente
Public Const CSIDL_RECENT As Long = &H8
' Senden An
Public Const CSIDL_SENDTO As Long = &H9
' Startmenü
Public Const CSIDL_STARTMENU As Long = &HB
' Autostart
Public Const CSIDL_STARTUP As Long = &H7
' System (bzw. System32)
Public Const CSIDL_SYSTEM As Long = &H25
' Vorlagen
Public Const CSIDL_TEMPLATES As Long = &H15
' Windows
Public Const CSIDL_WINDOWS As Long = &H24
Public Const NOERROR As Long = 0&
Function TempPath() As String
Dim strTmp As String
Dim l As Long
Dim fnr As Integer
10 On Error GoTo TempPath_ERR
20 strTmp = Space(512)
30 l = GetTempPath(Len(strTmp), strTmp)
40 TempPath = Left(strTmp, l)
On Error Resume Next
fnr = FreeFile
Open TempPath & "ttt" For Output As fnr
If Err <> 0 Then TempPath = TMP_NEU
Close #fnr
TempPath_EXIT:
50 Exit Function
TempPath_ERR:
60 Err_Box Error, MODULE_NAME, "TempPath"
70 Resume TempPath_EXIT
80 Resume
End Function
Function GetPath(Num As Long) As String
Dim Result As Long
Dim buff As String
Dim idl As ITEMIDLIST
10 On Error GoTo GetPath_ERR
20 Result = SHGetSpecialFolderLocation(Main.hWnd, Num, idl)
30 If Result = NOERROR Then
40 buff = Space$(512)
50 Result = SHGetPathFromIDList(ByVal idl.mkid.cb, ByVal buff)
60 If Result Then
70 GetPath = Left(buff, InStr(buff, Chr(0)) - 1)
80 End If
90 End If
GetPath_EXIT:
100 Exit Function
GetPath_ERR:
110 Err_Box Error, MODULE_NAME, "GetPath", Erl
120 Resume GetPath_EXIT
130 Resume
End Function
---- Ende Quelltext -----