Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Windows Vista Temp dir questions
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01147613
Message ID:
01147725
Vues:
20
>The only constant is change :)
>
>Do you know if GETENV("Temp") will work in Vista?

That should work, but SYS(2023) is probably the better way to get it.

As Craig points out the Documents and Settings folder is virtual in Windows and movable, so you shouldn't hardcode anything to these files (well, actually that should have never been done because those folder localize in different languages) so the API calls to get the folders are required.

Just in case you need some code to get those folders:
************************************************************************
* wwAPI :: GetSpecialFolder
****************************************
***  Function:
***    Assume: 0x002b -  Common Files
***            0x0026 -  Program Files
***            
***            
***      Pass:
***    Return:
************************************************************************
FUNCTION GetSpecialFolder(lnFolder)

IF VARTYPE(lnFolder) = "C"
   DO CASE
      *** MSDN -  CSIDL flag translates
      CASE lnFolder = "Program Files Common"
         lnFolder = 0x002B
      CASE lnFolder = "Program Files"
         lnFolder = 0x0026
      CASE lnFolder = "Documents Common"
         lnFolder = 0x002E
      CASE lnFolder = "Documents User" OR lnFolder = "My Documents"
         lnFolder = 0x0005
      CASE lnFolder = "Send To"
         lnFolder = 0x0009
      CASE lnFolder = "My Computer"
         lnFolder = 0x0011
      CASE lnFolder = "Desktop"
         lnFolder = 0
      CASE lnFolder = "Application Data"
         lnFolder = 0x001A
   ENDCASE
ENDIF


DECLARE INTEGER SHGetFolderPath IN Shell32.dll ;
      INTEGER Hwnd, INTEGER nFolder, INTEGER Token, INTEGER Flags, STRING @cPath
      
lcOutput = repl(CHR(0),256)
lnResult = SHGetFolderPath(Application.hWnd,lnFolder,0,0,@lcOutput)
IF lnResult = 0
   lcOutput = STRTRAN(lcOutput,CHR(0),"") + "\"
ELSE
   lcOutput = ""
ENDIF

RETURN lcOutput
ENDFUNC
*  wwAPI :: GetSpecialFolder
You can look up other constants on MSDN. One of those allows retrieval of the TEMP folder as well.


+++ Rick ---

>
>Bob
>
>
>>Not in Vista. Documents and Settings goes away.
>>
>>The proper way is to make an API call to find out where the Temp folder is located and use that.
>>
>>>I believe the proper place to put this stuff is in
>>>
>>>documents and settings/username/
>>>
>>>the user should have rights to the tree below this.
>>>
>>>Bob
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform