Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Annoying DOS window

Status
Not open for further replies.

madhatter2002

Programmer
Nov 6, 2002
73
PH
Here has been an on and on issue of the DOS window whenever a DOS command is being executed.

Is there a way of removing this DOS window when I execute a DOS command.

Problem is this, I have a program that will uncompressed about 40 arj files. And everytime that I run the extraction command of the arj in VFP code, the DOS window always appear.

I tried using the /N, yeah it does the trick of not showing the window, however, since the program does the decompression a number of times, the files being extracted are being overwritten or it fails to uncompress.

I tried somebody's function for this, and still the same problem.

Any suggestions??

thanks!
 
The problem is that you're using the RUN command. Try using a ShellExecute API instead and you won't get a DOS window. This is assuming you have the correct program associated with the arj file extension.
Code:
DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
        INTEGER lnHWnd, ;
        STRING lcAction, ;   
        STRING lcFileName, ;
        STRING lcExeParams, ;
        STRING lcDefDir, ;
        INTEGER lnShowWindow

ShellExecute( 0, 'open', "MyFile.arj", "", "", 1 )
Also, I haven't tried to uncompress a file this way, you may need to use a verb other than "open". Otherwise, it may be possible to control your uncompression program via commands or through COM.


-BP (Barbara Peisch)
 
madhatter2002

The lnShowWindow parameter should be 0 to hide the DOS window.

ShellExecute( 0, 'open', "MyFile.arj", "", "", 0 )

Alternatively, you could use the WinAPI call CreateProcess() or WSH, both of which would ensure control does not return to VFP until such time as the extraction program has finished.

FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
try this code

#define SW_SHOW_HIDDEN 0
#define SW_SHOW_NORMAL 1
#define SW_SHOW_MINIMIZED 2
#define SW_SHOW_MAXIMIZED 3
oShell = createobject("WScript.Shell")
oShell.Run("Your DOS Command",SW_SHOW_HIDDEN,.T.)
 
Take a look at Aircon's FAQ
faq184-4377 How to run DOS program in background effectively

He shows several examples including run/n, shellexecute, and the windows scripting host.



Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top