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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SUPPRESS ERROR messages Command ?? 2

Status
Not open for further replies.

kev100

Programmer
Jun 20, 2006
28
US
When running an external program via command line (using a process provided in this great forum!)....some type of error window pops up behind the apps' window.

It contains, evidently, a type of dos-like error message. It says something like:

'[shows the path of the current main FoxPro app]'
CMD.EXE was run with the above path as the directory.
UNC paths are not allowed. Defaulting to Windows directory.

dbMark suggested that it may be due to the use of a UNC path rather than a drive letter...and he's probably right.

That external app itself is actually stored on the computer's C:\...and a drive letter is used in the FoxPro command which runs it. The UNC must be in that exteral app's coding (which I cannot alter).

I'm thinnking that this error window is not Windows' based...because it does NOT show when running the app just from a command line (not calling it from within Foxpro)...and that the error is prob., therefore, FoxPro based.

If so...is there some sort of "Off-Error" command which will suppress all error reporting? Since the program runs fine with it ...is there any type of Foxpro command that simply turns-off Foxpro's reporting of errors?

Thanks very much
 
Code:
x=1
y=[a]

?x=y

ON ERROR ?[]

?x=y

ON ERROR

?x=y
 
Don't think that will work... Kev's issue is not so much supressing an "error" and not one generated by Fox, which is what On Error ?[] will fix.

A better title for this would be "Programatically close DOS window", which I don't know how to do. (Sorry Kev).



Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 

Kev,

Let me make sure I understand this. You say the external program runs OK, but it displays an error message, which you don't want the user to see. Is that right?

If so, I assume the "Dos-like message" you refer to is in fact a DOS command window. That's what you would expect when you use the RUN command.

The solution is simply to add /N immediately after the word RUN. The message will still flash up on the screen, but it will disappear immediately the command has finished executing.

Going further, if you add /N2, the message will be minimised. The only thing the user will see is a DOS icon on the taskbar.

If I have misunderstood the problem, my apologies.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
If using the drive letter makes the error go away and you can't rely on the drive letter you can adapt portions of faq184-4449 as needed.

Brian
 
After a bit more testing a research.....

The external app using a universal rather than a drive letter does not seem to be the case. In a test, a version of that app was used that did not access any storage at all (sort of a loop-back test version) and that extra cmd window with the error message would still appear.

Also....when the command line sent by VFP to run the program is simply typed in at c:\ in a cmd window (Start/Run/cmd/enter command line) it runs Without that extra window with the error message in the background.....that's what makes me suspect that the error is being generated by VFP...not the XP commad OS in general.

Here is the error message exactly:

'\\Server1\CustomerQuik\CustQdata\Apps'

CMD.exe was started with the above path as the current directory. UNC paths are not supported.
Defaulting to the Windows directory.


Note: "CustomerQuik" is the name of the VFP Program from which this other external program is being called.

The VFP command that runs this other external program is:

STORE "c:\programs\Prog1.exe " + TEL to cCommand
RUN (cCommand)

The above will run that external program just fine...but with the additional cmd window with the error message as a "pop-under" (i.e. behind the external program's window).


When...
c:\programs\Prog1.exe 8455551234
...is entered manually at a command line...this external program runs fine, and without that extra cmd window behind it.

Thanks very much.
 
Perhaps converting the call to a shellexecute would avoid the error message?
 
I agree with baltman.

You could also try this:

STORE "RUN/N c:\programs\Prog1.exe " + TEL to cCommand
&cCommand

Rob.
 
STORE "RUN/N c:\programs\Prog1.exe " + TEL to cCommand
&cCommand

BINGO !

That got it !

Thanks VERY much Rob and balt.

Nice clean Windows program window....no messy extra cmd window....looks ike it's just a feature of the calling VFP app.

THANKS !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top