comp.lang.ada
 help / color / mirror / Atom feed
From: John English <je@bton.ac.uk>
Subject: Re: About lauching files on Win98
Date: Tue, 13 Feb 2001 11:33:50 +0000
Date: 2001-02-13T11:33:30+00:00	[thread overview]
Message-ID: <3A891B9E.A89D9266@bton.ac.uk> (raw)
In-Reply-To: mailman.982016650.19433.comp.lang.ada@ada.eu.org

"Beard, Frank" wrote:
> 
> St�phane,
> 
> The simplest way to launch the program from the application is to use
> the WinExec API.  It has been superceded by the more complicated
> CreateProcess API, but I doubt if it will go away any time soon,
> if ever.
> 
> Depending on your Windows API binding (we are using Aonix which I
> think uses Intermetrics' binding), it will look something like:
> 
>       command : string := "iexplore.exe help.html" & ASCII.NUL;

I beg to differ. It is better to start the default browser using
ShellExecute than to assume the user has IE installed and that
the installation directory is in the user's path.

To use ShellExecute via the Win32 binding, try something like this
(not tested!):

  Win32.WinDef.HINSTANCE hInst :=
    Win32.ShellAPI.ShellExecute(
      System.Null_Address,                   -- no parent window
      To_LPCSTR("open" & ASCII.NUL),         -- command
      To_LPCSTR("c:\help.html" & ASCII.NUL), -- file to open
      System.Null_Address,                   -- no parameters
      System.Null_Address,                   -- no default directory
      Win32.WinUser.SW_SHOWNORMAL            -- show window normally
    );

The return value is a handle to the instance of the application that
was started (or a value <= 32 if an error occurred, but you'll need
to do an Unchecked_Conversion from Win32.WinDef.HINSTANCE, which is
basically a System.Address, to an Integer to check for this).

HTH,

-----------------------------------------------------------------
 John English              | mailto:je@brighton.ac.uk
 Senior Lecturer           | http://www.it.bton.ac.uk/staff/je
 Dept. of Computing        | ** NON-PROFIT CD FOR CS STUDENTS **
 University of Brighton    |    -- see http://burks.bton.ac.uk
-----------------------------------------------------------------



  reply	other threads:[~2001-02-13 11:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-12 22:21 About lauching files on Win98 Beard, Frank
2001-02-13 11:33 ` John English [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-02-16  0:17 Beard, Frank
2001-02-12 14:39 Stéphane Perret
     [not found] ` <96o913$m1loc$1@ID-76083.news.dfncis.de>
2001-02-23  8:37   ` Stephane Perret
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox