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

Just starting out? Need help? Post your questions and find answers here.
hdt888
User
User
Posts: 57
Joined: Sun Jul 07, 2024 8:42 am

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

Post 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.
PB 5.x + 6.x + Win10. Feel the ...Pure... Power.
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

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

Post 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).
pjay
Enthusiast
Enthusiast
Posts: 277
Joined: Thu Mar 30, 2006 11:14 am

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

Post by pjay »

Code: Select all

Debug GetUserDirectory(#PB_Directory_Programs)
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

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

Post by BarryG »

That doesn't return the correct path, pjay. Remember, he's using the 32-bit version of PureBasic.
pjay
Enthusiast
Enthusiast
Posts: 277
Joined: Thu Mar 30, 2006 11:14 am

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

Post by pjay »

Yeah - I misread the post... sorry.
Post Reply