Guys,
I really need help on closing a command window that i have created using the following code:
VB Code:
Public Function ExecCmd(cmdline$) Dim proc As PROCESS_INFORMATION Dim start As STARTUPINFO Dim ret& start.cb = Len(start) ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc) ret& = WaitForSingleObject(proc.hProcess, INFINITE) ret& = CloseHandle(proc.hProcess) End Function
This is the usage of it:
VB Code:
Call ExecCmd(App.Path & "\rar a " & rarName & ".rar " & "*.*")
Now the problem is that when i run the code on my XP machine it works perfectly, the window appears and compresses my files and then automatically closes itself. However, when i run it on a Win2K machine, the window appears, but does not close itself, rather i have to close it manually, which i don't want my users to have to do.
Can anyone tell me why this code doesn't perform on 2K, or if there is a way to check if the window has closed and close it if it hasn't closed?
Any help with this problem would be greatly appreciated, my boss is practically screaming for this to be finished.




Reply With Quote