How do i inform a win32 subwindow that parent windows is clo

in SDL1.3, do it yourself when processing SDL_WINDOWEVENT_CLOSE
in SDL1.2, do it yourself when processing SDL_QUIT------------------------
EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/

Thanks for reply.
I use SDL 1.2,
so i add TermirateProcess code at SDL_QUIT event,but it does not work… :frowning:
The process created by CreateProcess.
Below code TerminateProcess code works
when i close win32 window,
but failed when i close parent SDL window.

code below

static PROCESS_INFORMATION pi;
run =1;
while (run) {
SDL_Event event;
while (SDL_PollEvent (&event)) {
switch (event.type) {
case SDL_QUIT:
TerminateProcess(pi.hProcess,0);
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
run = 0;
break;
} } }

2010/5/31 Nathaniel J Fries > in SDL1.3, do it yourself when processing SDL_WINDOWEVENT_CLOSE

in SDL1.2, do it yourself when processing SDL_QUIT


EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Greets

WS Liu

try:

Code:

static PROCESS_INFORMATION pi;
run =1;
while (run) {
SDL_Event event;

  while (SDL_PollEvent (&event)) {
    switch (event.type) {
       case SDL_QUIT:
       {
          TerminateProcess(pi.hProcess,0);
          CloseHandle( pi.hProcess );
          CloseHandle( pi.hThread );  
          run = 0;
          break;
       }
    }
  }

}

Good code formatting is always useful.

As for why it’s not working, are you sure your SDL process has terminate rights on the other process?
You can find out by testing the return value of TerminateProcess (returns 0 on failure) and printing GetLastError().

So I can help you better: are events for the child window being handled by the second process? If not, what is the purpose of the second process? Couldn’t you just use a thread?------------------------
EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/

Hi
After i restart Visual Studio 2008 and rebuilt this code again,
This code works lol.
I think this maybe IDE tool’s problem or something else…
Anyway,thanks for remind me Good code formatting. :slight_smile:

2010/5/31 Nathaniel J Fries > try:

Code:

static PROCESS_INFORMATION pi;
run =1;
while (run) {
SDL_Event event;

  while (SDL_PollEvent (&event)) {
    switch (event.type) {
       case SDL_QUIT:
       {
          TerminateProcess(pi.hProcess,0);
          CloseHandle( pi.hProcess );
          CloseHandle( pi.hThread );
          run = 0;
          break;
       }
    }
  }

}

Good code formatting is always useful.

As for why it’s not working, are you sure your SDL process has terminate
rights on the other process?
You can find out by testing the return value of TerminateProcess (returns 0
on failure) and printing GetLastError().

So I can help you better: are events for the child window being handled by
the second process? If not, what is the purpose of the second process?
Couldn’t you just use a thread?


EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Greets

WS Liu