OS2 World.Com Forum

Subject  :  Closing window started via DosStartSession with noautoclose
Author  :  os2rocks
Date  :  26 Jul, 2005 on 20:33
I have a program which does a DosStartSession to start another application with the PgmControl of No Auto Close(SSF_CONTROL_NOAUTOCLOSE). The purpose of this was to ensure that the VIO window didn't disappear if the application trapped or was killed. I'm running on Warp 4 FP.

I'm trying to find a way to close the VIO window(other then manually) after it has been killed or trapped when I restart all of the applications at another time. I've tried to send a close window message(WM_CLOSE), destroy the window(WinDestroyWindow), and tried various other utilities out there to get rid of the window but nothing seems to work. Obviously I'm missing something here, anyone out there got any ideas.

Thanks......


Subject  :  Re:Closing window started via DosStartSession with noautoclose
Author  :  mobybrick
Date  :  27 Jul, 2005 on 13:42
Hi,

When you start your VIO app, you could try finding out the process ID of its parent (i.e. the process ID of CMD.EXE running it).

When your VIO process ID has ended, you can then kill the process of the correct copy of CMD.EXE.

Sounds easy, but I have no idea how to program this on OS/2!!

Regards,
Moby.


Subject  :  Re:Closing window started via DosStartSession with noautoclose
Author  :  os2rocks
Date  :  27 Jul, 2005 on 14:29
Moby,

The process has already been killed or trapped so killing the PID again doesn't work. The only thing still active is the VIO window.

Thanks,

os2rocks


Subject  :  Re:Closing window started via DosStartSession with noautoclose
Author  :  mobybrick
Date  :  27 Jul, 2005 on 15:15
I see.

Can't you launch the app using CMD.EXE /C first? Then CMD.EXE becomes the owner of the window and you might be able to kill it.

Alternatively, you might be left unfortunately trying to just make the window hidden, e.g. send it a WM_HIDE message.

Regards,
Moby.


Subject  :  Re:Closing window started via DosStartSession with noautoclose
Author  :  cyberspittle cyberspittle@yahoo.com
Date  :  28 Jul, 2005 on 19:30
The WM_ are Window Management APIs for Presentation Manager (AKA "PM") programming. You'll need to use a different set of APIs. You'll have to use one of the Dos_ APIs, perhaps DosStopSession is what you should be looking at.

Looking at the text of OS/2 2.0 Control Program Programming Guide (IBM OS/2 Technical Library published by Que)", you'll see the following:

"DosStopSession can be used by a parent session to stop one or all of its child sessions. If the child session specified in the call to DosStopSession has related sessions, the related sessions are also terminated. The parent session can be running in the foreground or the background when it calls DosStopSession. If the child session is running in the foreground when it is terminated, the parent session becomes the foreground session.

DosStopSession can only be called by a parent sesion for a child session. Neither the parent session itself, nor any grandchild, nor any other other descendant session beyond a child session, nor any unrelated session, can be the target of this call."

I hope this helps. One way to look at API programming is the same as Win32 (Win16) programming. Keep coding.


Powered by UltraBoard 2000 <www.ub2k.com>