Click to See Complete Forum and Search --> : Please resond quickly, newbie question


ross
February 24th, 2000, 12:55 PM
Hello all. I have been currntly running some apps they make shell calls
for instance

call shell("net use p: \blah blah blah\blah",vbHide)
This does what I need and never shows a prompt. But the problem is that the prompt ,even though hidden is still there, I have to do a control alt del to see it and then end the process. Is there something I can put in that shell command to exit the dos prompt. I know exit use to work for batch files. Thanks for any advice

Kyle Burns
February 24th, 2000, 01:24 PM
The Shell function returns the process ID of the application that you started. A DOS Window doesn't respond to the WM_CLOSE message (this is the message that politely asks an application to end), so to force it to close would require a couple of things. I haven't done this, so please take this as a suggestion and verify what I'm detailing with someone else or your MSDN library.
1) Use the process ID to call the OpenProcess() API function with PROCESS_ALL_ACCESS specified.

2) The OpenProcess call will return a handle to the process. Use this handle to call the TerminateProcess() API function.

3) To clean up after yourself, call the CloseHandle() API function, providing the handle returned by OpenProcess() as the argument.