UnderwareDESIGN

PlayBASIC => Resources => Source Codes => Topic started by: kevin on December 03, 2008, 05:05:59 PM

Title: Get The Windows Temp Folder of the Current User
Post by: kevin on December 03, 2008, 05:05:59 PM
 
This example returns the windows temp folder of the current user.


Related To:
Get Special Windows Folders (http://www.underwaredesign.com/forums/index.php?topic=2792.0)


[pbcode]

LinkDll "kernel32"
   GetTempPathA(nSize,lpBuffer) alias "GetTempPathA" as integer
EndLinkDll



Function GetTempPath()
   // Alloc a bank of 1024 bytes
   Size=1024
   ThisBank=newbank(Size)
   Ptr=GetBankPtr(thisBank)
   Status=GetTempPathA(Size,ptr)
   if Status
         Path$=PeekString(ptr,0)   ; peek a null termed string         
   endif
   Deletebank ThisBank
EndFunction path$


//
print GetTempPath()
Sync
waitkey

[/pbcode]