NW,<br>
If you right-click on the MSdos prompt icon, then select the Program tab, and check the 'close on exit' box, this will close shelled DOS boxes on exit. I'm not sure about SendKeys, I've never used it to try to control a DOS program. I think you'd need to get the Window Handle of the dos box or shelled program, since if the user did anything with the vb app to give it back the focus, the sendkeys would go to the vb app, not the intended program. <br>
<br>
The 'freeze' thing isn't a program it's just some API's that will guarantee the calling program (the VB app) can't recieve the focus until the shelled program has finished (or until a specified amount of time has passed). So, you need to know that you will be able to manually or programatically close the shelled program, since in the example below, the INFINITE constant is used as the timeout, so if the shelled program can't close, you'll never regain the VB app. For this reason, you need to have control over the shelled program, ie. you must be able to end it.:<br>
<br>
'Put these in the Declarations of a Module:<br>
Declare Function OpenProcess Lib "kernel32" (ByVal dwAccess As Long, ByVal fInherit As Integer, ByVal hObject As Long) As Long<br>
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long<br>
Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long<br>
Const SYNCHRONIZE = 1048576<br>
Const NORMAL_PRIORITY_CLASS = &H20&<br>
Const INFINITE = &HFFFF<br>
<br>
'Now here's how to make the Shell call:<br>
Dim ProcessId As Long, ProcessHandle As Long<br>
ProcessId = Shell(MyPgmName, vbNormalFocus)<br>
ProcessHandle = OpenProcess(SYNCHRONIZE, True, ProcessId)<br>
WaitForSingleObject ProcessHandle, INFINITE ,<----alterable<br>
'The execution stops here and the app will not accept Window Messages of any type until shelled pgm closes.<br>
CloseHandle ProcessHandle<br>
--Jim