borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (VB6 Removable Disk Notifacation)Next Topic (Error help!) New Topic New Poll Post Reply
AndreaVB Forum : VB General : ssfPERSONAL in WinXP
Poster Message
Serlio
Level: Guest


icon ssfPERSONAL in WinXP

Hello.

In VB6, I'm trying to obtain the "My documents" directory path for current user using the Shell object and the ssfPERSONAL (=&H5) constant (of ShellSpecialFolderConstants).

It works for all Windows versions except for Win XP. I don't have Win XP, hence I can't investigate the problem, but it seems that this value of ssfPERSONAL has no meaning for WinXP. I've searched in MSDN and Google, but I haven't found any useful information about it.

For example, this code doesn't work in Win XP:


    Dim objShell As New Shell32.shell
    
    MsgBox objShell.NameSpace(5).Items.Item.Path    


Can anybody help, please? Do I have to use another value in WinXP? Is there any other method to obtain the desired path?

Thank you in advance.

14-10-2004 at 06:15 AM
| Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: ssfPERSONAL in WinXP

It does retrieve MyDocuments path on WindowsXP professional...

____________________________
If you find the answer helpful, please mark this topic as solved.

14-10-2004 at 10:31 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: ssfPERSONAL in WinXP

YOu could use Environ function, it doesnt need any references like Shell32 does. Just this is necessary

msgbox environ("userprofile") & "\My Documents\"

Also, there is a SHGetSpecialFolderPath API (located in Shell32.dll) that can do the job....

____________________________
If you find the answer helpful, please mark this topic as solved.

14-10-2004 at 10:46 AM
View Profile Send Email to User Show All Posts | Quote Reply
Serlio
Level: Guest

icon Re: ssfPERSONAL in WinXP

quote:
It does retrieve MyDocuments path on WindowsXP professional...


Then the problem may be harder than expected... I am working in spanish Windows, I don't know if it is the problem. Some users are telling me that the program fails exactly in that line, but I have no access to their computers, and they don't know nothing about programming... It works nicely in my W2000 and for all W98 users that have given me feedback...

The environ() solution can't be taken, because "My Documents" is the english name, but it is different in different languages, and of course I want the program to run in all windows languages.

The SHGetSpecialFolderPath approach has the same effect as the objShell one, in fact the constant to be used is the same (&H5). I suspect that the NameSpace method of Shell OCX is calling to SHGetSpecialFolderPath function of DLL.

I will keep on trying more tricky solutions, I'll return here if success.

Thanks a lot for your helping, Goran. I didn't know about environ() function, so I have learned something...
14-10-2004 at 07:18 PM
| Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: ssfPERSONAL in WinXP

What do you mean by "program fails exactly in that line"? And do they have VB installed on those machines so they are exeting code line by line? Do they get some error in that line or the return value is zero lenght string?

____________________________
If you find the answer helpful, please mark this topic as solved.

14-10-2004 at 11:02 PM
View Profile Send Email to User Show All Posts | Quote Reply
VBer
Level: Guest

icon Re: ssfPERSONAL in WinXP

Code Breakdown For (SHGetFolderPath) API.

&H5  = My Documents
&HC  = (Virtual) \My Documents\
&H27 = \My Documents\My Pictures
&H2E = \Documents
&HD  = \My Documents\My Music
&HE   = \My Documents\My Video
&H0  = Virtual Desktop
&H1  = Virtual Internet Explorer (icon on desktop)
&H2  = Start Menu\Programs
&H3  = Virtual My Computer\Control Panel
&H4  = Virtual My Computer\Printers
&H6  = \Favorites
&H7  = Start Menu\Programs\Startup
&H8  = \Recent
&H9  = \SendTo
&HA  = Virtual \Recycle Bin
&HB  = \Start Menu
&H10 = \Desktop
&H11 = Virtual My Computer
&H12 = Virtual  Network Neighborhood
&H13 = \nethood (may dupe My Network Places)
&H14 = Virtual windows\fonts
&H15 = \templates
&H16 = \Start Menu
&H17 = \Programs
&H18 = \Startup
&H19 = \Desktop
&H1A = \Application Data
&H1B = \PrintHood
&H1C = \Local Settings\Applicaiton Data (non roaming)
&H1D = nonlocalized startup program group
&H1E = (NT) nonlocalized Startup group for all NT users
&H1F = (NT) all user's favorite items
&H20 = temporary Internet files
&H21 = (NT) Internet cookies
&H22 = (NT) Internet history items
&H23 = \Application Data
&H24 = Windows directory or SYSROOT
&H25 = GetSystemDirectory()
&H26 = \Program Files
&H28 = \
&H29 = x86 system directory on RISC
&H2A = x86 Program Files folder on RISC
&H2B = \Program Files\Common
&H2C = x86 Program Files Common folder on RISC
&H2D = \Templates
&H2F = \Start Menu\Programs\Administrative Tools
&H30 = \Start Menu\Programs\Administrative Tools
&H31 = Virtual Network and dial-up connections folder
&H35 = My Music folder for all users
&H36 = My Pictures folder for all users
&H37 = My Video folder for all users
&H38 = System resource directory
&H39 = Localized resource directory
&H3A = Links to OEM specific apps for all users
&H3B = \Local Settings\Application Data\Microsoft\CD Burning
&H3D = Virtual Computers Near Me folder

17-10-2004 at 03:34 PM
| Quote Reply
AndreaVB Forum : VB General : ssfPERSONAL in WinXP
Previous Topic (VB6 Removable Disk Notifacation)Next Topic (Error help!) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder