Fwd: Re: avoiding command window with wxHaskell on Windows?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Re: avoiding command window with wxHaskell on Windows?

Dean Herington
>Date: Mon, 25 Jun 2007 20:19:50 -0400
>To: Jens Fisseler <[hidden email]>
>From: Dean Herington <[hidden email]>
>Subject: Re: [Haskell-cafe] avoiding command window with wxHaskell on Windows?
>Cc: [hidden email], [hidden email]
>
>At 10:10 PM +0200 6/23/07, Jens Fisseler wrote:
>>On Sat, 23 Jun 2007, Dean Herington wrote:
>>
>>>  But if I double-click the .exe file, I get a command window that
>>>hangs around
>>>  (but doesn't appear to do anything, fortunately) until the
>>>program terminates.
>>>  How can I avoid this command window?
>>
>>With gtk2hs, using "-optl-mwindows" as a command line option for GHC lets
>>me get rid of this window. Perhaps it will do the same for wxHaskell?
>
>Yes, that did the trick!  Thanks a lot!

But now I've discovered that using "-optl-mwindows" creates a program
that doesn't work when invoked from a command line.  Is there any way
to create a program that can work when invoked either from a command
line or through double-clicking?

Dean
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Re: avoiding command window with wxHaskell on Windows?

Duncan Coutts
On Fri, 2007-06-29 at 23:22 -0400, Dean Herington wrote:
> >Date: Mon, 25 Jun 2007 20:19:50 -0400

> >>With gtk2hs, using "-optl-mwindows" as a command line option for GHC lets
> >>me get rid of this window. Perhaps it will do the same for wxHaskell?
> >
> >Yes, that did the trick!  Thanks a lot!
>
> But now I've discovered that using "-optl-mwindows" creates a program
> that doesn't work when invoked from a command line.  Is there any way
> to create a program that can work when invoked either from a command
> line or through double-clicking?

You'll have to be a bit more specific about what you mean. Perhaps you
mean that when launched from the command line you cannot interact with
the program via that command line interface. That is indeed standard
windows behaviour.

You can create new terminals at runtime using Win32 functions, but I'm
not sure if you can figure out if the program was launched from a
terminal and associate with that terminal.

But perhaps you meant something else.

Duncan

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Re: avoiding command window with wxHaskell on Windows?

Esa Ilari Vuokko
On 6/30/07, Duncan Coutts <[hidden email]> wrote:

> On Fri, 2007-06-29 at 23:22 -0400, Dean Herington wrote:
> > >Date: Mon, 25 Jun 2007 20:19:50 -0400
>
> > >>With gtk2hs, using "-optl-mwindows" as a command line option for GHC lets
> > >>me get rid of this window. Perhaps it will do the same for wxHaskell?
> > >
> > >Yes, that did the trick!  Thanks a lot!
> >
> > But now I've discovered that using "-optl-mwindows" creates a program
> > that doesn't work when invoked from a command line.  Is there any way
> > to create a program that can work when invoked either from a command
> > line or through double-clicking?
>
> You'll have to be a bit more specific about what you mean. Perhaps you
> mean that when launched from the command line you cannot interact with
> the program via that command line interface. That is indeed standard
> windows behaviour.
>
> You can create new terminals at runtime using Win32 functions, but I'm
> not sure if you can figure out if the program was launched from a
> terminal and associate with that terminal.
>
> But perhaps you meant something else.

Assuming it's not something else.

As far as I know, the console/non-console application is marked in exe-header,
and you can, in principle, have two entrypoints to a program, one for
console and
one without.  Unfortunately that's not supported by most tools (and probably
none outside Microsoft toolchains.)

So, in practice, either you make console applications, or non-console
application.
And as Duncan says, you can open new console if you don't have one, but that
will have different window than parent process had.  Opening new console might
also require some interfacing with haskell runtime system if you want to use
default putStrLn and friends.  I think I saw a library to help with
that, but I can't
find it right now.

Best regards,
Esa
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: avoiding command window with wxHaskell on Windows?

Dean Herington
At 8:13 PM +0300 6/30/07, Esa Ilari Vuokko wrote:

>On 6/30/07, Duncan Coutts <[hidden email]> wrote:
>>On Fri, 2007-06-29 at 23:22 -0400, Dean Herington wrote:
>>>  >Date: Mon, 25 Jun 2007 20:19:50 -0400
>>
>>>  >>With gtk2hs, using "-optl-mwindows" as a command line option for GHC lets
>>>  >>me get rid of this window. Perhaps it will do the same for wxHaskell?
>>>  >
>>>  >Yes, that did the trick!  Thanks a lot!
>>>
>>  > But now I've discovered that using "-optl-mwindows" creates a program
>>>  that doesn't work when invoked from a command line.  Is there any way
>>>  to create a program that can work when invoked either from a command
>>>  line or through double-clicking?
>>
>>You'll have to be a bit more specific about what you mean. Perhaps you
>>mean that when launched from the command line you cannot interact with
>>the program via that command line interface. That is indeed standard
>>windows behaviour.
>>
>>You can create new terminals at runtime using Win32 functions, but I'm
>>not sure if you can figure out if the program was launched from a
>>terminal and associate with that terminal.
>>
>>But perhaps you meant something else.
>
>Assuming it's not something else.
>
>As far as I know, the console/non-console application is marked in exe-header,
>and you can, in principle, have two entrypoints to a program, one for
>console and
>one without.  Unfortunately that's not supported by most tools (and probably
>none outside Microsoft toolchains.)
>
>So, in practice, either you make console applications, or non-console
>application.

It turns out I was confused (due I think to terribly slow network
response).  I have experimented more and believe I understand:
-optl-mwindows creates a program that is suitable for "launching" (by
either double-clicking or via a command line).  The program so
launched does not have a console or any direct way to communicate to
the launcher.  In particular, the launcher continues on its way
immediately and cannot obtain the launchee's termination status.

For the application I'm building, besides being able to launch it as
above, I want also to be able to "invoke" it (normally from a command
line).  A program so invoked can interact with its invoker, and the
invoker awaits the program's completion and gets its termination
status.

 From what Esa said, it appears unlikely that a single .exe can be
built easily using Haskell and wxHaskell that can be both launched
and invoked.  (In which case being able to produce a shared library
containing the common code for the two .exe files would be nice!)

Thanks for all the replies.

Dean
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: avoiding command window with wxHaskell on Windows?

Claus Reinke
> For the application I'm building, besides being able to launch it as
> above, I want also to be able to "invoke" it (normally from a command
> line).  A program so invoked can interact with its invoker, and the
> invoker awaits the program's completion and gets its termination
> status.
>
> From what Esa said, it appears unlikely that a single .exe can be
> built easily using Haskell and wxHaskell that can be both launched
> and invoked.

as a partial workaround, you could create a shortcut for the .exe,
and set the shortcut properties to start in a minimized window..

claus

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe