> I misunderstood. I thought you said you were running a .BAT
> file. .BAT files _DO_ run "under" the shell so terminating the CMD.EXE
> process would terminate them.
No. I am running a BAT file, but 16-bit apps do still have execute inside a
VDM. Killing CMD.EXE has no effect on the currently executing 16-bit app.
> Can you run (CreateProcess) the program yourself directly instead of
> indirectly via the shell? If you can - run it "in it's own
> memory space" (CREATE_SEPARATE_WOW_VDM) and save the pid you get
> back - it will be the pid for the NTVDM.
It must run under CMD.EXE. No other way to start a 16-bit DOS program. I
do use CREATE_SEPARATE_WOW_VDM so when I kill the NTVDM, it
doesnt kill other 16-bit processes that might be running.
> Enum childwindows (for all windows) and use GetWindowThreadProcessID
> to determine the pid for each hwnd enum returns. Then post
> (not send) a WM_CLOSE or WM_QUIT message to those hwnds.
Yes. This works. I found a shortcut though. When I AllocConsole, I set the
consoletitle. I can then FINDWINDOW to get its handle and then the
ProcessID. Now I can kill it.
> Or does your note about it "not using STD_OUTPUT" refer to a problem
> with using CreateProcess to run the 16bit app directly? CreateProcess
> lets you redirect the output - to files or pipes - is there some
> reason you can't do that with this program?
No, I havent been able to redirect the output. The DOS program used direct
screen writes as cant capture output at all under win9x. I tried several
variation that people have done on to try and capture the output and was
eventually pointed to an MSDN article that told me it must be done through a
console.
Anyway, I have finally killed the bugger.
----------------------------------------------------------
Phil Scadden, Institute of Geological and Nuclear Sciences
41 Bell Rd South, PO Box 30368, Lower Hutt, New Zealand
Ph +64 4 5704821, fax +64 4 5704603
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"