For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
THIS IS NOT FOR .NET.
I need this in vbs, js and vba
I want to findout the path to the active user his pictures.
I know how the find the documents, desktop of favorites throu specialfolders but pictures is'nt in it
In google I didn't find anything usefull.
OptionExplicitPrivateConst S_OK = &H0
PrivateConst S_FALSE = &H1
PrivateConst E_INVALIDARG = &H80070057
PrivateConst MAX_PATH = 260PrivateConst SHGFP_TYPE_CURRENT = 0PrivateConst CSIDL_MYPICTURES = &H27
PrivateDeclareFunction SHGetFolderPath Lib"shfolder" _
(ByVal hwndOwner AsLong, ByVal nFolder AsLong, _
ByVal hToken AsLong, ByVal dwFlags AsLong, _
ByVal pszPath AsString) AsLongPrivateFunction GetFolderPath(ByVal csidl AsLong) AsStringDim path AsStringDim returnValue AsLong
path = String(MAX_PATH, 0)
returnValue = SHGetFolderPath(0, csidl, 0, SHGFP_TYPE_CURRENT, path)
GetFolderPath = Left(path, InStr(1, path, Chr(0)) - 1)
' The CSIDL in nFolder is valid, but the folder does not exist.
' Use CSIDL_FLAG_CREATE to have it created automatically
GetFolderPath = vbNullString
' nFolder is invalid
Err.Raise 5, "csidl", "Invalid folder"EndSelectEndFunctionPublicFunction GetPicturesFolderPath() AsString
GetPicturesFolderPath = GetFolderPath(CSIDL_MYPICTURES)
For script running locally, you could read the folder path from the registry (HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders). However, there is a warning in that key telling you not to do that!
Since you can't call Windows functions directly from script, you'd need to create a COM object to call the Windows API, and invoke that object from your script.
For script running in the browser, there is no way to access this information.
EDIT: There's also HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders, which doesn't have that warning. But the recommendation is still to use the Windows API.
I don't think the names would be localized, but I don't have a non-English version of Windows to check.
I've just added a link to a blog post from Raymond Chen, who explains that the "Shell Folders" key exists solely to permit four programs written in 1994 to continue running on the RTM version of Windows 95.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
The names are localized. I got a folder "My Pictures", one called "Pictures" and one "Mijn Afbeeldingen". To make things worse, this does not say anything about the actual location, as my "Mijn Afbeeldingen" points to a completely different harddrive.
I'd expect the names of the folders to be localized
Richard Deeming wrote:
But what about the names of the values in the "User Shell Folders" registry key?
Yes, my apologies for not thinking.
English, both on a Dutch and a German machine. Called "CommonPictures" on this machine, pointing to the correct physical path. Keys are usually not translated, because that would defeat the purpose of having one.
..so, remotely reading the registry as an admin, just to find a path? Still sounds like a bad idea
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
nglish, both on a Dutch and a German machine. Called "CommonPictures" on this machine, pointing to the correct physical path. Keys are usually not translated, because that would defeat the purpose of having one.
Considering the "fix" that this key was created for, would it really surprise anyone if someone at MS did something that stupid?