Trying to add an exit confirmation dialog to Cygwin setup.exe, failing

Terry Fleming
Sat Mar 14 15:04:00 GMT 2009

Andy Koppe <> wrote:
>> Cygwin setup.exe's message loop is this
>>  while (GetMessage (&msg, NULL, 0, 0) != 0
>>         && GetMessage (&msg, (HWND) NULL, 0, 0) != -1)
> I might not sufficiently understand Win32 messaging, but to me that
> looks as if it's dropping every other message. Shirley it should be
> calling GetMessage only once?

That's what I thought too. But that's the current official source
code, and setup.exe works fine with it like that.
I did try replacing that loop by the standard loop used in Win32
tutorials, which as I mentioned in my original post, I'm using
successfully in my test WinMain program:
  while(GetMessage(&msg, NULL, 0, 0))
The replacement caused no apparent change in the behaviour of
setup.exe at all; it still works fine. More relevant to my problem, it
still closes when I press alt+f4, unlike my test WinMain program. That
proves that the message loop isn't the problem, so I still have my
original question: Where's the correct place to intercept SC_CLOSE in

More information about the Cygwin-apps mailing list