Page 1 of 1

PB 4.20 and Windows Vista Portuguese Environment

Posted: Wed Jul 15, 2009 1:21 pm
by jmauver
Hello all,

I am developing a PB application which will run on a Windows Vista. The Vista is in portuguese language (pt -pt).

I need to find out how I can get the path for the ALL USERS startup folder using PB.

In english it would be "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"

Perhaps I should hard code the path instead of going to registry as this application is only for portuguese users. Could anyone tell me how the path would be in portuguese language ?


Thanks a lot,

Mauver

Posted: Wed Jul 15, 2009 1:30 pm
by cas

Code: Select all

Procedure.s SpecialFolder(folderno)
  Protected listptr=0
  Protected result$=Space(270)
  SHGetSpecialFolderLocation_(0,folderno,@listptr)
  SHGetPathFromIDList_(listptr,@result$)
  ProcedureReturn Trim(result$)
EndProcedure 

Debug SpecialFolder(#CSIDL_COMMON_STARTUP)
Got this code somewhere from this forums. :wink:

Posted: Wed Jul 15, 2009 5:58 pm
by Num3
The code posted above is the best way to determine the path, which in Portuguese Windows Vista is "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup".

In the explorer bar it comes up has a virtual path:
">>Windows > Menu Iniciar > Programas > Arranque" but the hardcoded path is the one above!

Posted: Wed Jul 15, 2009 7:22 pm
by Marco2007
I like that: Image

Posted: Thu Jul 16, 2009 1:19 pm
by jmauver
Thanks Cas. The code works perfectly.

Num3, yes, that virtual path was confusing me. Thanks for that. Just to clarify, the hard coded path for "Documents" for a given user on Vista in portuguese would be "c:\Users\%username%\Documents" ?

Hey Marco, that avatar means that nothing in this life is 100% absolute.
This Simbol(Yin-Yang) represents the ancient Chinese understanding of how things work. The outer circle represents "everything", while the black and white shapes within the circle represent the interaction of two energies, called "yin" (black) and "yang" (white), which cause everything to happen. They are not completely black or white, just as things in life are not completely black or white, and they cannot exist without each other.

Posted: Fri Jul 17, 2009 10:49 am
by Num3
jmauver wrote:Thanks Cas. The code works perfectly.

Num3, yes, that virtual path was confusing me. Thanks for that. Just to clarify, the hard coded path for "Documents" for a given user on Vista in portuguese would be "c:\Users\%username%\Documents" ?
Well since my Vista is connecting to a server, my path is "C:\Users\utilizador\Documents", but if i work offline, directly on the harddrive it's "C:\Users\%usernamehere%\Documents".

But...

At home i've changed the Documents folder to Drive D:\Documentos\, so you better use the code posted with:

Code: Select all

Debug SpecialFolder(#CSIDL_MYDOCUMENTS)