Clipper On Line • Ver Tópico - Objeto FileSystemObject, método GetSpecialFolder
Mudar para estilo Clássico
Aqui você poderá oferecer suas Contribuições, Dicas e Tutoriais (Texto ou Vídeo) que sejam de interesse de todos.
Postar uma resposta

Objeto FileSystemObject, método GetSpecialFolder

18 Jul 2019 13:53

Objeto FileSystemObject
Código:
#define SystemFolder    1   //The Windows system folder (/windows/system or /windows/system32)
#define TemporaryFolder 2   //The folder that stores temporary files (../windows/temp)
#define WindowsFolder   0   //The root folder of the Windows system folder tree (/windows or /winnt)

cPathName := GetSpecialFolder( TemporaryFolder ) // Retorna o path da pasta temp do usuário

FUNCTION GetSpecialFolder( nFolderSpec )
LOCAL oFile, lOk := .T., cPathName := ""

   Hb_Default(@nFolderSpec , 0)

   BEGIN SEQUENCE WITH __BreakBlock()
      oFile := Win_OlecreateObject("Scripting.FileSystemObject")
   RECOVER
      lOk := .F.
   END

   IF lOk
      BEGIN SEQUENCE WITH __BreakBlock()
         WITH OBJECT oFile
            cPathName := :GetSpecialFolder( nFolderSpec ):Path
         END             
      RECOVER
         cPathName := ""
      END
   ENDIF
   
RETURN cPathName
Postar uma resposta