[Haskell-cafe] avoiding command window with wxHaskell on Windows?

Dean Herington heringtonlacey at mindspring.com
Sat Jun 30 16:42:17 EDT 2007


At 8:13 PM +0300 6/30/07, Esa Ilari Vuokko wrote:
>On 6/30/07, Duncan Coutts <duncan.coutts at worc.ox.ac.uk> 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


More information about the Haskell-Cafe mailing list