I'm not one of the people mentioned in the subject and frankly it gets a bit annoying when people think that there are only a handful of people on this bb that can answer questions!!
Try this;
Then just call..Code:Private Type StartupInfo cb As Long lpReserved As String lpDesktop As String lpTitle As String dwX As Long dwY As Long dwXSize As Long dwYSize As Long dwXCountChars As Long dwYCountChars As Long dwFillAttribute As Long dwFlags As Long wShowWindow As Integer cbReserved2 As Integer lpReserved2 As Long hStdInput As Long hStdOutput As Long hStdError As Long End Type Private Type Process_Information hProcess As Long hThread As Long dwProcessID As Long dwThreadID As Long End Type Private Declare Function CreateProcessA Lib "kernel32" (ByVal lpApplicationName As Long, ByVal lpCommandLine As String, ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, lpStartupInfo As StartupInfo, lpProcessInformation As Process_Information) As Long Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Public Sub ExecCmd(cmdline$) Dim proc As Process_Information Dim start As StartupInfo Dim ret As Long ' Initialize the STARTUPINFO structure: start.cb = Len(start) ' Start the shelled application: ret = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc) ' Wait for the shelled application to finish: ret = WaitForSingleObject(proc.hProcess, INFINITE) Call GetExitCodeProcess(proc.hProcess, ret&) Call CloseHandle(proc.hThread) Call CloseHandle(proc.hProcess) End Sub
ExecCmd("MYDOSPROGRAM.EXE")
and VB will not continue executing until the program has finished - in order to make a DOS program close when it has finished (without using the properties);
ExecCmd("COMMAND.COM /C MYEXE.EXE") for Windows '95/'98
ExecCmd("CMD.EXE /C MYEXE.EXE") for Windows NT




Reply With Quote