Hi guys,
I would like to have a button called "Open..." with an icon of whatever current default web browser is on it too.
Anyone has any code snippet to do this?
TIA
function WebBrowserIcon()
// code based on https://stackoverflow.com/questions/136 ... er-using-c
local oReg, cProgId, cPath := "", nPos, cBrowser := "Unknown browser", cCom, cIcon := ""
// determine prog id of default browser
oReg := TReg32():New(HKEY_CURRENT_USER, "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" )
cProgId := oReg:Get("ProgId")
oReg:Close()
do case
case cProgId == "IE.HTTP"
cBrowser := "Internet Explorer"
cIcon := "ie.bmp"
case cProgId == "FirefoxURL"
cBrowser := "Firefox"
cIcon := "firefox.bmp"
case cProgId == "ChromeHTML"
cBrowser := "Chrome"
cIcon := "chrome.bmp"
case cProgId == "OperaStable"
cBrowser := "Opera"
cIcon := "opera.bmp"
case cProgId == "SafariHTML"
cBrowser := "Safari"
case cProgId == "AppXq0fevzme2pys62n3e0fbqa7peapykr8v"
cBrowser := "Microsoft Edge"
cIcon := "edge.bmp"
endcase
if !empty(cIcon)
cIcon := ud_bmpDir() + "\" +cIcon
endif
// use the progid to determine path to exe
if !empty(cProgId)
oReg := TReg32():New(HKEY_CLASSES_ROOT, cProgId + "\shell\open\command" )
cPath := oReg:Get()
oReg:Close()
if (nPos := at(".exe", cPath)) > 0
cPath := left(cPath, nPos+5)
endif
endif
if !empty(cPath)
*cCom := 'iconsext.exe /save '+cPath+' "'+ud_bmpDir()+'" -icons'
*waitrun(cCom, SW_HIDE)
endif
return cIcon
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 37 guests