-
Hi
I'm running shell commands from my program and I want to keep them hidden from the user. My code is:
Shell "c:\windows\cmdproc.bat", vbHide
However when I do this the program remains running and winoldap appears in the task manager. I tried closing it using the DestroyWindow, but I don't think it's working because DestoryWindow can only kill windows I create.
Do
hWnd = FindWindow(vbNullString, "Finished - cmdproc")
DestroyWindow (hWnd)
Loop While (hWnd <> 0) = False
Is there anyway for me to either close the shell box automatically when it finishes?
Maybe by having the program hit the "x" button, or use the "close" menu command? If these are possibilitys can someone point me to an example program. Also would that work while the window was hidden?
thanks
-
well I've been reading similar posts about my problem and they say to set the properties of my cmdproc.bat to close on exit. I tried this and it worked, however is there a way to set this property from VB?
-
try this instead:
Dim winHwnd As Long, rval As Long
winHwnd = FindWindow(vbNullString, "winoldapp")
If winHwnd <> 0 Then
rval = PostMessage(winHwnd, WM_CLOSE, 0&, 0&)
End If
================
it will close winoldapp when executed! be sure to include the declarations for the API call! :cool:
-
wow, that worked great, thank you. one thing however, i've been using vbapi.com for API refference, but vbapi.com seems to be lacking some API functions. anyone have other sources be them online or possible in book form?