|
-
May 22nd, 2000, 05:16 PM
#1
Thread Starter
Junior Member
Hi guys
i´m using these API function to find dir \Temp\ in Windows NT
[code]
Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" _
(ByVal nbufferlength As Long, ByVal ipbuffer As String) As Long
Public Const MAX_PATH = 260
[code]
[code]
Public Function GetTmpPath()
Dim strfolder As String
Dim lngResult As String
strfolder = String(MAX_PATH, 0)
lngResult = GetTempPath(MAX_PATH, strfolder)
If lngResult <> 0 Then
GetTmpPath = Left(strfolder, InStr(strfolder, Chr(0), -1))
Else
GetTmpPath = ""
End If
End Function
[code]
When i click it occurs a run-time error 13 Type mismatch
[code]
Private Sub Command3_Click()
Call MsgBox("O caminho da Temp " & GetTmpPath, 64+vbInformation)
[code]
Any Help
Thanks
-
May 22nd, 2000, 05:30 PM
#2
Lively Member
Why not make your own function that looks up the "Temp" and/or "Tmp" environment settings, as in (e.g., untested)
Code:
Public Function GetTemp() As String
Dim s As String
s = Environ("Temp")
If Len(s) = 0 Then
s = Environ("Tmp")
If Len(s) = 0 Then
' error - no environ setting
err.Raise 10001, "GetTemp", "No Temp Environment Setting found"
End If
End If
GetTemp = s
End Function
HTH!
Toot
Some cause happiness wherever they go; others, whenever they go.
-
May 22nd, 2000, 08:36 PM
#3
Thread Starter
Junior Member
Originally posted by Toot
Why not make your own function that looks up the "Temp" and/or "Tmp" environment settings, as in (e.g., untested)
Code:
Public Function GetTemp() As String
Dim s As String
s = Environ("Temp")
If Len(s) = 0 Then
s = Environ("Tmp")
If Len(s) = 0 Then
' error - no environ setting
err.Raise 10001, "GetTemp", "No Temp Environment Setting found"
End If
End If
GetTemp = s
End Function
HTH!
Toot
Thanks a lot TOOT it works
Have u have e-mail?
-
May 22nd, 2000, 08:50 PM
#4
Lively Member
Some cause happiness wherever they go; others, whenever they go.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|