Trucos Conocer el directorio temporal (temp) de windows 95

Habitualmente el directorio temporal de windows 95 es c:\windows\temp, pero esto depende de cada instalación. Para poder averiguar el directorio temporal empleado en un pc :

En un módulo declaramos :
Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" _
                 (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Public Const MAX_PATH = 260


Y creamos la siguiente función que nos devolverá el directorio deseado :

Public Function GetTmpPath() as string
 Dim strFolder As String
 Dim lngResult As Long
 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



Trucos Trucos

Visual Basic Página de Visual Basic

Página principal Página principal

www.jrubi.com