Improvement to GetPBFolder()
Posted: Sat May 10, 2008 9:28 am
GetPBFolder() will fail if the .pb file association has not been made yet (on first run of PureBasic.exe).
You can try reading the uninstall information as a failsafe:
You can try reading the uninstall information as a failsafe:
Code: Select all
If Not Folder.s
If RegOpenKeyEx_(#HKEY_LOCAL_MACHINE,"Software\Microsoft\Windows\CurrentVersion\Uninstall\PureBasic_is1",0,#KEY_ALL_ACCESS,@hKey)=#ERROR_SUCCESS
If RegQueryValueEx_(hKey,@"InstallLocation",0,@Type,Value,@MaxStringSize)=#ERROR_SUCCESS
Folder.s=PeekS(Value)
EndIf
RegCloseKey_(hKey)
EndIf
EndIf