Help and Support
 

powered byLive Search

How to hide the FoxPro Run Command window in Visual FoxPro

Article ID:141551
Last Review:February 15, 2005
Revision:4.2
This article was previously published under Q141551
On This Page

SUMMARY

By using the WinExec Windows API function, you can execute an MS-DOS command or program without the user seeing the FoxPro Run Command window or another MS-DOS session.

Back to the top

MORE INFORMATION

The following program creates a sample function that executes an MS-DOS command or program and keeps the MS-DOS window hidden. The program takes one parameter, the command to be executed.

To maintain control over the MS-DOS window, the program sends the command through a PIF file. To keep this window hidden, use the Windows PIF Editor to make the following changes to the PIF file you use (this example uses Foxrun.pif in the Visual FoxPro directory):
1.Click to select the Close Window on Exit check box.
2.Set Display Usage to Windowed.

Back to the top

Code sample

*---------------- Run.prg -----------------------------
* Sample program to Execute an MS-DOS command and keep
* the MS-DOS window hidden.
*
*To use this function in FoxPro to create a new directory,
* use the following command:
*
*    DO run WITH "MD C:\VFP\TESTDIR"
*

FUNCTION run
PARAMETER doscmd

DECLARE INTEGER WinExec IN win32api AS run ;
   STRING command, INTEGER param

* To have control over the visibility of the
* MS-DOS command, call it through a .pif file.
*
* IMPORTANT: (1) Be sure the "Close Window on Exit" check box in
* the PIF file is selected. (2) Be sure "Windowed" is the
* selected "Display Usage."

cmdstart = SYS(2004) + "FOXRUN.PIF /C "

* Now concatenate the two pieces of the command:

fullcmd = cmdstart + doscmd

retval = run(fullcmd, 0)

RETURN retval
*------- End of program ----------------------
				

Back to the top


APPLIES TO
Microsoft Visual FoxPro 3.0 Standard Edition
Microsoft Visual FoxPro 3.0b Standard Edition
Microsoft Visual FoxPro 6.0 Professional Edition
Microsoft Visual FoxPro 7.0 Professional Edition
Microsoft Visual FoxPro 8.0 Professional Edition

Back to the top

Keywords: 
kbcode kbhowto kbsample KB141551

Back to the top

Article Translations

 

Related Support Centers

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.