Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21909

How to get Current User folder - WIndows 7?

$
0
0
Hi, I know how to get the user's documents folder, but for windows 7, this folder does not contain the users Picture folder and all of those ussual folders, rather these are at the main user folder.

And what i want to get is the user folder, when i use this

Code:

myProgramFilesDir = SHGetSpecialFolderPath(0, strBufferD, _
        CSIDL_PERSONAL, False)
    strBufferD = Left$(strBufferD, InStr(strBufferD, Chr(0)) - 1)

Then i get the main documents folder, do i need to trim the documents folder to get the C:\Users\TheUser\ with above code i get this -> C:\Users\TheUser\Documents
So this is what i want to get C:\Users\TheUser\
What constant should i use to only get what i want?

This is also abit tricky, cause on windows 8, this folder does contain those common folders.

Thank you for any advice.

Viewing all articles
Browse latest Browse all 21909

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>