Page 1 of 1

How to get path C:\Program Files, not C:\Program Files (x86) on Windows x64 using PB compiler x86 ?

Posted: Sun Aug 18, 2024 3:55 am
by hdt888
I ran a test with these 2 constants on Windows x64.

Code: Select all

#CSIDL_PROGRAM_FILES = $26
#CSIDL_PROGRAM_FILESX86 = $2A
It's alway return C:\Program Files (x86)

How to get path C:\Program Files by using PB Compiler x86 ?

Thank you.

Re: How to get path C:\Program Files, not C:\Program Files (x86) on Windows x64 using PB compiler x86 ?

Posted: Sun Aug 18, 2024 4:12 am
by BarryG

Code: Select all

Debug GetEnvironmentVariable("ProgramW6432") 
Returns "C:\Program Files" on both PB 5.73 (32-bit) and PB 6.10 (64-bit).

Re: How to get path C:\Program Files, not C:\Program Files (x86) on Windows x64 using PB compiler x86 ?

Posted: Sun Aug 18, 2024 10:48 am
by pjay

Code: Select all

Debug GetUserDirectory(#PB_Directory_Programs)

Re: How to get path C:\Program Files, not C:\Program Files (x86) on Windows x64 using PB compiler x86 ?

Posted: Sun Aug 18, 2024 10:49 am
by BarryG
That doesn't return the correct path, pjay. Remember, he's using the 32-bit version of PureBasic.

Re: How to get path C:\Program Files, not C:\Program Files (x86) on Windows x64 using PB compiler x86 ?

Posted: Sun Aug 18, 2024 10:52 am
by pjay
Yeah - I misread the post... sorry.