finding_20the_20bbc_20basic_20installation_20directory
Finding the BBC BASIC installation directory
by Jon Ripley, May 2006, rewritten February 2008
To find the installation directory of BBC BASIC for Windows use the following FN_ReadBB4WInstallPath function which takes no parameters and returns a path to where BBC BASIC is installed or an empty string if no installation is found:
DEF FN_ReadBB4WInstallPath LOCAL hkey%,res%,lbuf%,type%,key$(),P% lbuf%=255:DIM buf% LOCAL lbuf%,key$(5) key$()="Software\R T Russell\BBC BASIC for Windows", "InstallPath", \ \ "Software\Microsoft\Windows\Html Help", "bbcwin.chm", \ \ "Software\Microsoft\Windows\Help", "bbcwin.hlp" WHILE $$buf%="" AND P%<6 SYS "RegOpenKeyEx", &80000002, key$(P%), 0, &20001, ^hkey% TO res% IF res%=0 THEN SYS "RegQueryValueEx", hkey%, key$(P%+1), 0, ^type%, buf%, ^lbuf% TO res% SYS "RegCloseKey", hkey% ENDIF IF $$buf%>"" IF RIGHT$($$buf%)<>"\" $$buf%+="\" P%+=2 ENDWHILE =$$buf%
Here we check in order of preference three three known registry locations where the BB4W installation path may be stored. The first is an installation path set by recent versions of the install and upgrade tools when they are used. The second is a path to the documentation and the third is a legacy key required to cope with early versions of BBC BASIC for Windows.
The following code demonstrates the use of FN_ReadBB4WInstallPath:
PRINT "BBC BASIC was installed in: ";FN_ReadBB4WInstallPath
finding_20the_20bbc_20basic_20installation_20directory.txt · Last modified: 2024/01/05 00:22 by 127.0.0.1