Library tutorials & articles
Getting System Folders Easily via API
- Introduction
- Windoze Directory
- System Directory
- Temporary Directory
- Finally...
Temporary Directory
Well the most liked directory to take up so much space and yet people start
deleting files from their Windows Directory (hmmmm....)! So heres another way
of retrieving the Temporary Directory: Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA"
(ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Const MAX_LENGTH = 512
Public Function GetTempDirectory() As String
Dim s As String
Dim c As Long
s = Space$(MAX_LENGTH)
c = GetTempPath(MAX_LENGTH, s)
If c > 0 Then
If c > Len(s) Then
s = Space$(c + 1)
c = GetTempPath(MAX_LENGTH, s)
End If
End If
GetTempDirectory = IIf(c > 0, Left$(s, c), "")
End Function
Okay time to wrap things up... if you lazy to cut/copy/paste all the code i've
done the work for your convienence. The next part as all the code wrapped in
a module so you can easily reference any path you want!
Related articles
Related discussion
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
When you need the Temp folder, the easy (and clean .Net way) is to use: Path.GetTempPath()
it will still work for change dpaths... i used TweakXP to try it out on a few VMs and it worked fine... as far as other languaegs go... i only get English versions of OS's from MS so i dont know what the effects are, i suppose its teh same but i aint sure... amybe someone else maybe able to tell you.
so if the user changes their dir from say C:\WinNT\System32\ to C:\WindowsNT\System Files\ would i still be able to get the Windows DIR and System DIR?
also what about foreign languages?
sorry i couldnt reply earlier, I only saw my post now!
thank-you for your kind words!
Hey,
I must say this is EXTREEMLY useful for a nutcase like myself!
I infact had the exact problem you said most people have.
Thanks alot! It really helps!
This thread is for discussions of Getting System Folders Easily via API.