public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: John Wiersba <jrw32982@yahoo.com>
To: Doug Henderson <djndnbvg@gmail.com>,
	 "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: Re: run.exe flashes non-hidden console window in cygwin64 on Win7Pro-64
Date: Thu, 23 Oct 2014 19:15:00 -0000	[thread overview]
Message-ID: <1414091548.99397.YahooMailNeo@web162806.mail.bf1.yahoo.com> (raw)
In-Reply-To: <CAJ1FpuMzZ6_KJqZVFjvW0gnXHXmvvWFzy6D0MSo9ZaS0mXsT8Q@mail.gmail.com>

Thanks, Doug.  

I use cygstart.exe to start windows programs (such as winword or notepad) from 

a mintty/bash console in a way that allows the mintty console to be closed 

while the windows application is still active.


I thought run.exe was meant to be used from shortcuts to run cygwin programs 

without flashing a console window on the desktop.  I don't think it's needed
to start programs from a mintty console.


>________________________________
> From: Doug Henderson <djndnbvg@gmail.com>
>To: "cygwin@cygwin.com" <cygwin@cygwin.com> 
>Sent: Thursday, October 23, 2014 2:34 PM
>Subject: Re: run.exe flashes non-hidden console window in cygwin64 on Win7Pro-64
> 
>
>On 23 October 2014 06:24, John Wiersba > wrote:
>> Maybe I'm confused.  Isn't the purpose of run.exe to start a
>> cygwin program without creating a (visible) console window?
>> I can just start a cygwin program directly without the indirection of
>> run.exe if I don't care about the random flashing console window.
>>
>> From the run.exe manpage:
>>   run will do this for you.  It works as intermediate and starts a program 

>>   but makes the console window hidden.
>
>AFAIK, all programs that run in Windows need a window handle in order
>to receive events, and to pass to a lot of windows functions. If your
>program create a windows before it tries to do anything that requires
>a window, that window gets used. When your program does not create its
>own windows, the start up code tries to attach you to an existing
>console window, and if there is not one, it creates it.
>
>A Windows GUI program starts at winmain(). This entry point does not
>have the same requirements as the C standard main() entry point.
>Mainly, you do not have the stdin, stdout, and stderr attached to
>anything, and you do not have a window. Creating a console or GUI
>window is entirely up to your code.
>
>Normally, any non-GUI program will attach to the console window where
>it starts. A "dos" type program will attach to the window running the
>cmd.exe that started it, and a cygwin program will get attached to the
>mintty console window to which your shell is attached,
>
>For both types of non-GUI programs, the msvcrt.dll or cygwin1.dll
>runtime code will setup stdin, stdout and stderr before entering
>main(). The runtime startup code will create a console window for you
>if you did not inherit one from your parent process, and the code will
>attach those file pointers to the console window
>
>In any system: Windows, cygwin, linux, or whatever, to create a
>windowless process, you close those initial file pointers or file
>handles and fork a new process. In the original process, you close
>your window if necessary, you call exit(), and the runtime will close
>your window if necessary. In the new process, you do what ever you
>want.
>
>When you have a cmd.exe window, you use "start" to fire off a new
>program and control what happens to its window with command line
>options.
>When you have a shell in a cygwin console, you use "run.exe" at the
>shell prompt.
>When you use a shortcut, you have not initial window, so the
>msvcrt.dll runtime creates one for you, and uses the properties of the
>shortcut to control how that window is created.
>
>At the shell prompt, try the following commands:
>
>$ /cygdrive/c/windows/system32/notepad.exe
>
>$ /cygdrive/c/windows/system32/notepad.exe &
>
>$ run /cygdrive/c/windows/system32/notepad.exe
>
>$ run /cygdrive/c/windows/system32/notepad.exe &
>
>use ps to check how the notepad process is connected to cygwin. Try
>exiting the shell after the second command to see why you want to use
>run.
>
>Anyway, that's how I think things work. But I may be wrong. It may
>give you some ideas on where to look for more correct and/or detailed
>answers.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2014-10-23 19:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16 19:43 Starting mintty via run.exe John Wiersba
2014-10-16 23:34 ` Eliot Moss
2014-10-17  3:39   ` John Wiersba
2014-10-17  3:51     ` John Wiersba
2014-10-17 13:14       ` Eliot Moss
2014-10-17 21:52         ` cygcheck -s segfaults in cygwin64 on Win7Pro-64 John Wiersba
2014-10-18  3:59           ` Marco Atzeri
2014-10-20 22:39             ` John Wiersba
2014-10-21  8:03               ` Andrew Schulman
2014-10-21 11:03                 ` Corinna Vinschen
2014-10-21 15:31                   ` John Wiersba
2014-10-21 16:54         ` run.exe flashes non-hidden console window " John Wiersba
2014-10-22 13:50           ` Andrey Repin
2014-10-22 20:37             ` John Wiersba
2014-10-23  0:20               ` Doug Henderson
2014-10-23  1:35                 ` Andrey Repin
2014-10-23  8:42                   ` Andrew Schulman
     [not found]                   ` <1414037878.2285.YahooMailNeo@web162805.mail.bf1.yahoo.com>
2014-10-23 12:24                     ` John Wiersba
2014-10-23 17:56                       ` Achim Gratz
2014-10-23 18:47                         ` John Wiersba
2014-10-23 18:34                       ` Doug Henderson
2014-10-23 19:15                         ` John Wiersba [this message]
2014-10-23 19:40           ` Doug Henderson
2014-10-23 20:26             ` John Wiersba
2014-10-23 20:52               ` Achim Gratz
2014-10-23 21:25                 ` John Wiersba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414091548.99397.YahooMailNeo@web162806.mail.bf1.yahoo.com \
    --to=jrw32982@yahoo.com \
    --cc=cygwin@cygwin.com \
    --cc=djndnbvg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).