Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Open a HTML-file?


2 replies to this topic

Ralf

Ralf
  • Full Members
  • 63 posts

Posted 16 January 2003 - 12:36

Hi,
I want to open a HTML-file at the end of the installation and I think it is flexible if the HTML-Viewer is used which is actually installed on the PC. So I don´t want to define in the IS6 script that always the internet explorer is needed.

Is there a way to open a file which file type is already registered in windows?

If not how can I start the internet explorer automatically?

Thanks,
Ralf

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 16 January 2003 - 14:44

Here's some sample code I use to launch the associated application for HTML files.

Code Sample
function BrowserLaunchURL(URLSite)
 NUMBER nvType, nResult, nvSize;
 STRING szRegKey, sExplore;
begin
 RegDBSetDefaultRoot(HKEY_CLASSES_ROOT);
 nvType = REGDB_STRING;
 szRegKey = "\\htmlfile\\shell\\open\\command";
 RegDBGetKeyValueEx(szRegKey, "", nvType, sExplore, nvSize);
 
 // remove quotes
 //LongPathToQuote(sExplore, FALSE);  //NOTE: COMMENTED OUT DUE TO PROBLEM UNDER NT4.
 // if quotes are still found ... get what's inside the quotes
 if ( StrFind(sExplore, "\"") = 0 ) then
   StrSub(sExplore, sExplore, StrFind (sExplore, "\"")+1, StrLength (sExplore));
   StrSub(sExplore, sExplore, 0, StrFind (sExplore, "\""));
 endif;

 Dbg("Browser = '"+sExplore+"'.", INFORMATION);
 Dbg("URL = '"+URLSite+"'.", INFORMATION);
 
 nResult = LaunchAppAndWait(sExplore, URLSite, WAIT);
 if ( nResult < 0 ) then
   Dbg("Unable to launch the default browser.", WARNING);
 endif;
 
 return nResult;
end;

user posted image

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 23 January 2003 - 19:01

You can use the ShellExecute Windows API, as shown in the sample on this site.