comp.lang.ada
 help / color / mirror / Atom feed
* About lauching files on Win98
@ 2001-02-12 14:39 Stéphane Perret
       [not found] ` <96o913$m1loc$1@ID-76083.news.dfncis.de>
  0 siblings, 1 reply; 5+ messages in thread
From: Stéphane Perret @ 2001-02-12 14:39 UTC (permalink / raw)


Hello everybody,

I doing a program and in the purpose of simplicity I prefer to do HTLM
files for the 
help stuff. The trick is to lauch the file, say HELP.HTML directly from
the program with a command that I do not know.

Someone gave me a procedure that lauch files by using the START program,
the heck is that during the process a very ugly dos window appears.

Please, Help.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: About lauching files on Win98
@ 2001-02-12 22:21 Beard, Frank
  2001-02-13 11:33 ` John English
  0 siblings, 1 reply; 5+ messages in thread
From: Beard, Frank @ 2001-02-12 22:21 UTC (permalink / raw)
  To: 'comp.lang.ada@ada.eu.org'

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;
      status  : WinApi.UINT := 0;

   begin

      status := WinApi.WinExec(lpCmdLine => To_LPCSTR(command),
                               uCmdShow  => WinApiConstants.SW_HIDE);

I don't think you will need the pathname for Internet Explorer,
but you will need to supply it for "help.html".

Hope this helps.
Frank

-----Original Message-----
From: Stéphane Perret [mailto:stephane.perret@maths.unine.ch]
Sent: Monday, February 12, 2001 9:39 AM
To: comp.lang.ada@ada.eu.org
Subject: About lauching files on Win98


Hello everybody,

I doing a program and in the purpose of simplicity I prefer to do HTLM
files for the 
help stuff. The trick is to lauch the file, say HELP.HTML directly from
the program with a command that I do not know.

Someone gave me a procedure that lauch files by using the START program,
the heck is that during the process a very ugly dos window appears.

Please, Help.
_______________________________________________
comp.lang.ada mailing list
comp.lang.ada@ada.eu.org
http://ada.eu.org/mailman/listinfo/comp.lang.ada




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: About lauching files on Win98
  2001-02-12 22:21 Beard, Frank
@ 2001-02-13 11:33 ` John English
  0 siblings, 0 replies; 5+ messages in thread
From: John English @ 2001-02-13 11:33 UTC (permalink / raw)


"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
-----------------------------------------------------------------



^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: About lauching files on Win98
@ 2001-02-16  0:17 Beard, Frank
  0 siblings, 0 replies; 5+ messages in thread
From: Beard, Frank @ 2001-02-16  0:17 UTC (permalink / raw)
  To: 'comp.lang.ada@ada.eu.org'

Well, I said simplest not best.  The solution I gave works fine on
Windows 98, but your solution is probably "better" and more portable
across the Windows platforms.

And, I really wasn't trying to assume that he had Internet Explorer.
If it wasn't on his system he could simply substitute his browser of
choice.  It was just an example of what he could put in the string,
and hopefully he could figure out how to do the substitution.  If not,
he shouldn't be touching a computer, much less programming it.

However, since he specified Win98, if I were to assume a browser, I
would be 99.9% safe in assuming Internet Explorer would be on his
system, unless he intentionally removed it.  But, that wasn't my
point anyway.

The same reason I dislike CreateProcess is the same reason I dislike
ShellExecute.  Because of the excessive number of parameters for 
doing something simple.  Granted, ShellExecute has less parameters 
than CreateProcess.

So, in most cases I will still opt for WinExec because of it's
simplicity.

Frank

-----Original Message-----
From: John English [mailto:je@bton.ac.uk]
Sent: Tuesday, February 13, 2001 6:34 AM
To: comp.lang.ada@ada.eu.org
Subject: Re: About lauching files on Win98

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: About lauching files on Win98
       [not found] ` <96o913$m1loc$1@ID-76083.news.dfncis.de>
@ 2001-02-23  8:37   ` Stephane Perret
  0 siblings, 0 replies; 5+ messages in thread
From: Stephane Perret @ 2001-02-23  8:37 UTC (permalink / raw)


Good, it works perfectly.
Thank you.
Stephane.

Joachim Schroeer wrote:
> 
> Hello,
> 
> I have this procedure for launching an exe from a  windows program (gui, not
> console).
> 
> with Win32.Windef, Win32.Shellapi, Win32.Winuser, Interfaces.C;
> ...
> package ...
> 
>   procedure Start_Application(Executable : in String;
>                               Parameter  : in String := "") is
> 
>     C_Operation  : aliased Interfaces.C.Char_Array :=
>                            Interfaces.C.To_C("open");
>     C_Executable : aliased Interfaces.C.Char_Array :=
>                            Interfaces.C.To_C(Executable);
>     C_Parameter  : aliased Interfaces.C.Char_Array :=
>                            Interfaces.C.To_C(Parameter);
>     Exe : Win32.Windef.Hinstance;
>   begin
>     Exe := Win32.Shellapi.Shellexecute
>       (Hwnd         => Win32.Winuser.Getfocus,
>       Lpoperation  => C_Operation (C_Operation'First)'Unchecked_Access,
>        Lpfile       => C_Executable(C_Executable'First)'Unchecked_Access,
>       Lpparameters => C_Parameter (C_Parameter'First)'Unchecked_Access,
>       Lpdirectory  => null,
>       Nshowcmd     => Win32.Winuser.Sw_Shownormal);
>   end Start_Application;
> 
> Best regards
>     J. Schr�er

-- 
_________________________________
http://members.xoom.com/s_perret/

"Unless you're prepared to care for something, you don't deserve to have it."



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-02-23  8:37 UTC | newest]

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

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