If Dir(myDocs & "\My Videos", vbDirectory) = "" Then _
MkDir myDocs & "\My Videos"
' If "My Videos" doesn't exist in "My Documents", create it
GetMyVideosFolder = myDocs & "\My Videos"
End Function
Vista uses "Users" where XP uses "Documents and Settings"
I even tried to make a folder in root called Documents and Settigs, but Vista will not allow this name used.
You are detecting the name & location of the "My Documents" folder for the current user (the code up to line 14), which will work no matter what that folder is called, or what drive/folder it is in.
Is there a way to adapt prev code to work in both vista and xp?
or should I just try and make a new folder in my app folder?
Hi,
CSIDL_MYVIDEO = &HE works both on Vista and XP, to make sure I tested attached sample project on both OS's.
CSIDL_MYDOCUMENTS = &HC doesn't work on vista, but if you use CSIDL_PERSONAL = &H5 it gives the proper folder on both OS's.
Though XP allowed developers to save data to the app folder (Note: the installed application, as in "C:\Program Files\Your App"), Vista no longer does. You have no choice then to use the AppData folder, which also works both on XP and Vista and AFAIK W2K.
I've written a sample module that takes care of all that, which you can change to your needs. (Attachement 2)
HTH
Jottum™ XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.
CSIDL_MYVIDEO = &HE works both on Vista and XP, to make sure I tested attached sample project on both OS's.
HTH
Thank you, by modifying the first attachment (myspecialfolder)
I implemented into my App, I have tested with XP and it still works.
I will be able to test it later this evening on Vista.
Will report back results.
I sent app to a friend with vista, seem to still get same "run-time error 75"
this is what I have in app
vb Code:
Option Explicit
Private Const USER_AGENT = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)"
Private re As RegExp
Private http As XMLHTTP
Private highestPos As Double
Private Declare Function SHGetSpecialFolderPath Lib "shell32.dll" Alias "SHGetSpecialFolderPathA" (ByVal hwndOwner As Long, ByVal lpszPath As String, ByVal nFolder As Long, ByVal fCreate As Long) As Long
Public Enum CSIDL_VALUES
CSIDL_MYVIDEO = &HE
End Enum
Private Const MAX_PATH = 260
Private Function GetSpecialFolder(folder As Long) As String
Dim FolderPath As String * MAX_PATH
SHGetSpecialFolderPath 0, FolderPath, folder, 0
GetSpecialFolder = TrimNull(FolderPath)
End Function
Private Function TrimNull(Str1 As String) As String
I sent app to a friend with vista, seem to still get same "run-time error 75"
this is what I have in app
[...]
Again, this still works for XP, just not Vista? (maybe I over looked something?)
Thanx
Hi,
I've tested your code, and both on XP and Vista it opens the MyVideo folder in Explorer for the current user.
I'll attach the sample project again (it's not the same as the first) , perhaps you should compile it and send it to your friend and see what result he gets. If it works, something else is going on with your other code.
HTH
Jottum™ XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.