PB 4.20 and Windows Vista Portuguese Environment

Everything else that doesn't fall into one of the other PB categories.
jmauver
User
User
Posts: 36
Joined: Thu Jun 19, 2008 1:21 pm
Location: London

PB 4.20 and Windows Vista Portuguese Environment

Post 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
cas
Enthusiast
Enthusiast
Posts: 597
Joined: Mon Nov 03, 2008 9:56 pm

Post 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:
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post 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!
Marco2007
Enthusiast
Enthusiast
Posts: 648
Joined: Tue Jun 12, 2007 10:30 am
Location: not there...

Post by Marco2007 »

I like that: Image
PureBasic for Windows
jmauver
User
User
Posts: 36
Joined: Thu Jun 19, 2008 1:21 pm
Location: London

Post 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.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post 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)
Post Reply