Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
procedure GetExePath
lparameters pcExeName
* returns fill path of EXE file taking it from Windows registry, or empty string
set step on
m.pcExeName = JustFName(m.pcExeName)
DECLARE LONG RegOpenKey IN advapi32 LONG hKey, STRING lpSubKey, LONG @phkResult
DECLARE LONG RegQueryValue IN advapi32 LONG hKey, STRING lpSubKey, STRING @lpValue, LONG @lpcbValue
DECLARE LONG RegCloseKey IN advapi32 LONG hKey
#DEFINE HKEY_LOCAL_MACHINE -2147483646 && bitset(0,31)+2
LOCAL lnErrorRes, phkResult, lpSubKey, lpValue, lpcbValue
phkResult = 0
lpSubKey = 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths'
lpValue = .NULL.
lpcbValue = 0
lnErrorRes = RegOpenKey(HKEY_LOCAL_MACHINE, lpSubKey, @phkResult)
IF lnErrorRes # 0 OR phkResult = 0 && Cannot open registry key - unknown error
= MESSAGEBOX('Cannot open Windows registry.')
RETURN ''
ENDIF
&& open key for exe
lnErrorRes = RegQueryValue(phkResult, m.pcExeName, @lpValue, @lpcbValue)
IF lnErrorRes # 0 OR lpcbValue = 0 && exe-file not registered or path not stored (0 byte length)
lnErrorRes = RegCloseKey(phkResult)
= MESSAGEBOX('Exe file not registered in Windows.')
RETURN ''
ENDIF
lpValue = SPACE(lpcbValue) && in lpcbValue - size of string
lnErrorRes = RegQueryValue(phkResult, m.pcExeName, @lpValue, @lpcbValue)
IF lnErrorRes # 0 OR ISNULL(lpValue) OR EMPTY(lpValue)
&& cannot read default value - unknown error
lnErrorRes = RegCloseKey(phkResult)
= MESSAGEBOX('Cannot read value from registry.')
RETURN ''
ENDIF
lnErrorRes = RegCloseKey(phkResult)
IF lnErrorRes # 0
&& cannot close key - ignore this error
ENDIF
&& in lpValue - path for exe
lpValue = CHRTRANC(lpValue, CHR(0), '') && delete ending #0
return lpValue