Win2k User profile path

G

Guest

Hi All

I want to know the temp directory for the particular windows 2000 user (lets
say IP)
that is logged in.
Example:
C:\Documents and Settings\IP\Temp\

OR just the user profile directory example:

C:\Documents and Settings\IP\

Can anyone please help me with a code sample to get this path.

Thanks & regards
IP
 
G

Guest

To be accurate I need to know this path:

C:\Documents and Settings\IP\Local Settings\Temp

where IP is the current user logged in.

Thanks
IP
 
G

Guest

Ok, I found the solution:

Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal
nBufferLength As Long, ByVal lpBuffer As String) As Long

Private Declare Function GetLongPathName Lib "kernel32" _
Alias "GetLongPathNameA" (ByVal ShortPath As String, _
ByVal LongPath As String, ByVal BufferSize As Long) As Long


Public Function GetTempFolder() As String
Dim str As String * 1000
Dim length As Long
length = GetTempPath(1000, str)
Dim strTempFolder As String
strTempFolder = Left$(str, length)
length = GetLongPathName(strTempFolder, str, 1000)
strTempFolder = Left$(str, length)
GetTempFolder = strTempFolder
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top