How to kill a process on Win32?

Hi,

I’m porting an application from Linux to Windows using the SDL library. To
kill the program on linux, I’m using signals, but Windows can’t manage
signals, so how should I do to kill my process, because I can’t use
messages, my program doesn’t use the WndProc() function to manage them.

I launch my program from a console, my window appears, and when I click on
the cross in the right-top corner my window disappears, but my program is
still running in the console.
Thanks for any help.

Regards,
Fabrice Louis._________________________________________________________________

Your program should listen for an “SDL_QUIT” event, and at that point,
you should make it terminate happily.

My paint program ‘Tux Paint’, for example, does the same thing on a 'quit’
event as it does if the user clicks the “Quit” button inside the application
(an “SDL_MOUSEBUTTONDOWN” event at a particular x/y coordinate), or
pushes the [Escape] key (an “SDL_KEYDOWN” event)… it pops up a question
inside the program’s window asking “Quit - Are you sure?”

It’s interesting that your window vanishes when you click the 'Close’
button in Windows without you doing anything. But then, I don’t use Windows
myself, so I don’t have much experience with SDL under Windows at the moment.

-bill!On Thu, Mar 20, 2003 at 10:25:01AM +0100, Brian Warner wrote:

Hi,

I’m porting an application from Linux to Windows using the SDL library. To
kill the program on linux, I’m using signals, but Windows can’t manage
signals, so how should I do to kill my process, because I can’t use
messages, my program doesn’t use the WndProc() function to manage them.

I launch my program from a console, my window appears, and when I click on
the cross in the right-top corner my window disappears, but my program is
still running in the console.
Thanks for any help.


bill at newbreedsoftware.com Hire me!
http://newbreedsoftware.com/bill/ http://newbreedsoftware.com/bill/resume/

[…]

It’s interesting that your window vanishes when you click the
’Close’ button in Windows without you doing anything.
[…]

It does? I haven’t actually tried to ignore or delay the exit with
SDL, but Delphi + VCL definitely lets you do it… From what I
remember of raw Win32 programming, a window won’t do anything
unless the application explicitly passes mesages back to the GUI
through the messages loop. Can’t even move the window if the loop is
stopped. Insanely frustrating when you’re debugging…

//David Olofson - Programmer, Composer, Open Source Advocate

.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Thursday 20 March 2003 10.34, Bill Kendrick wrote:

> From what I remember of raw Win32 programming, a window won't do *anything* > unless the application explicitly passes mesages back to the GUI > through the messages loop. Can't even move the window if the loop is > stopped.

Can’t… move… a window?

boggle

-bill!On Thu, Mar 20, 2003 at 01:04:11PM +0100, David Olofson wrote:

Right. All messages are sent to the application message loop, and the
WM gets events passed on from there. (Same way it worked in Win16.)
Stop the app in the debugger and all it’s windows freeze totally, WM
functions included.

This is the main reason why the Windows developer at work uses a dual
head setup…

//David Olofson - Programmer, Composer, Open Source Advocate

.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Thursday 20 March 2003 17.15, Bill Kendrick wrote:

On Thu, Mar 20, 2003 at 01:04:11PM +0100, David Olofson wrote:

From what I remember of raw Win32 programming, a window won’t do
anything unless the application explicitly passes mesages back
to the GUI through the messages loop. Can’t even move the window
if the loop is stopped.

Can’t… move… a window?

Brian Warner wrote:

Hi,

I’m porting an application from Linux to Windows using the SDL library.
To kill the program on linux, I’m using signals, but Windows can’t
manage signals, so how should I do to kill my process, because I can’t
use messages, my program doesn’t use the WndProc() function to manage them.

I launch my program from a console, my window appears, and when I click
on the cross in the right-top corner my window disappears, but my
program is still running in the console.

Look up ExitProcess and TerminateProcess in the Visual-C++ documentation
set.> Thanks for any help.

Regards,
Fabrice Louis.


Michel Bardiaux
Peaktime Belgium S.A. Bd. du Souverain, 191 B-1160 Bruxelles
Tel : +32 2 790.29.41