User Tools

Site Tools


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%
          IF $$buf%>"" IF RIGHT$($$buf%)<>"\" $$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
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
finding_20the_20bbc_20basic_20installation_20directory.txt · Last modified: 2018/04/17 16:09 by tbest3112