I am trying to display a local html file using the default browser. My solution works with XP and Windows 7, but fails with Windows 8.1.
This code works on XP and Windows 7, but does nothing on Windows 8. No error, no web page displayed. Any ideas?
f=SpecialFolder.SharedApplicationData
If f <> Nil Then
app.helpString=f.AbsolutePath + "MyFolder\\help.html"
Else
MsgBox("The configuration file is missing.")
End If
showurl(app.helpString)
[quote=167558:@Bryan Dodson]I am trying to display a local html file using the default browser. My solution works with XP and Windows 7, but fails with Windows 8.1.
This code works on XP and Windows 7, but does nothing on Windows 8. No error, no web page displayed. Any ideas?
f=SpecialFolder.SharedApplicationData
If f <> Nil Then
app.helpString=f.AbsolutePath + "MyFolder\\help.html"
Else
MsgBox("The configuration file is missing.")
End If
showurl(app.helpString)[/quote]
You should not use AbsolutePath which is deprecated. Use ShellPath instead and it works fine.
Thanks for the help. No I am getting a popup window asking the user to select an application from a list to open the htm file. This only happens on Windows 8. Any suggestions?
Your Windows 8 is misconfigured. The message you are getting means no program is set to open .htm files. I doubt very much this will be the case for your customers, since by default, Internet Explorer is set to open htm files. But you can force it to open the file (or any file) by calling it specifically :
dim s as new shell
dim explorer as folderitem = GetFolderItem("c:\\Program Files\\Internet Explorer\\iexplore.exe", FolderItem.PathTypeShell)
dim f as folderitem = specialfolder.desktop.child("index.htm")
s.Execute(explorer.ShellPath + " " + f.ShellPath)
For your own use, you may want to set Windows 8 to open htm files. Open “Default Programs” in the control panel, then click “Associate a file type or protocol with a program” go down the list until you find .htm and click “Change program…” on the upper right corner, then select Internet Explorer, or whichever is your preferred browser.