Program Files DIR

linum

Active Member
Licensed User
I know I can use the Hardware Lib to get the Program Files DIR of a Device with something like this:

B4X:
DDir = Hardware1.GetSpecialFolder(Hardware1.sfProgramFiles)


But my question is; how can I get the Program Files DIR of the Desktop? I'm programming an app that checks if a third party app is installed in the Program Files DIR but I know that in the real world not all Windows installations are installed in the C: DIR so I want to check for this somehow. Is there any way to check for the DIR on the Desktop?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can do it with the help of the Door library (program is attached)
B4X:
Sub App_Start
    obj.New1(False)
    obj.CreateNew("System.Environment" & obj.System_Mscorlib)
    Msgbox(obj.RunMethod2("GetFolderPath", "ProgramFiles", "System.Environment+SpecialFolder"))
End Sub

You can replace "ProgramFiles" with any of the values here: Environment.SpecialFolder Enumeration (System)
 

Attachments

  • 1.sbp
    561 bytes · Views: 196
Top