怎样使DOS命令窗口隐含或不出现或最小化
编号:QA001837
建立日期: 1999年10月9日 最后修改日期:1999年10月26日
所属类别:
愚姐:
vfp 5.0以上
winnt pwin95
在vfp中运行dos命令时,怎样使dos命令窗口隐含或不出现或最小化?我也曾用过“!/7 copy yy.dbf a:”类似的命令,但dos命令窗口仍然出现,破坏了我的程序界面。请赐教。
回答:
拷贝文件这样的工作不用调用DOS命令,你可以使用COPY FILE命令,如:
COPY FILE yy.dbf a:yy.dbf
要隐藏DOS窗口可以参考微软的Knowledge Base的文章:“Q141551 ow to Hide the "FoxPro Run Command" Window in Visual FoxPro”。(下面是该文章的一部分)
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. Select the Close Window on Exit check box.
2. Set Display Usage to Windowed.
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 one of the following commands that illustrate two
* ways to call the function and achieve the same result:
*
* = run("MD C:\VFP\TESTDIR")
*
* 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 ----------------------
|
如果是使用FoxPro 2.x,可以参考微软的Knowledge Base的文章:“Q131621 ow to Hide the "FoxPro Run Command" Window”。
此问题由李海回答。
| |
|
|
| |
|
|