你可以利用wscript的shell, 可以通过activeX口调用。具体可以参考windows script host的资料。
函数原型:
WshShell.Run(strCommand[, [intWindowStyle][, bWaitOnReturn]])
intWindowStyle可以选的值。所谓的后台运行就是Hide吧。
0 vbHide Hides the window. Another window is activated (is shown and gets the focus).
1 vbNormalFocus Activates the window and shows it. If the process is already active and the window is minimized or maximized, the previous size and position are restored.
2 vbMinimizedFocus Activates the window and minimizes it. The button on the taskbar receives the focus.
3 vbMaximizedFocus Activates the window, maximizes it, and gives it the focus.
4 vbNormalNoFocus Displays a window in its most recent size and position. The active window remains active.
5 Activates the window in its current size and position.
6 vbMinimizedNoFocus Minimizes the window and activates the next top-level window in the z-order.
7 Displays the window as an icon (minimized). The active window remains active.
8 Displays the window in its current state. The active window remains active.
9 Activates and displays the window. If a window is minimized or maximized, Windows restores the original size and position. An application should specify this flag when restoring a minimized window. (This parameter can't be used with the Run method.)
10 Sets the show state based on the state of the program that started the application.
给个例子:
- [FONT=courier new]
- (setq shell (vlax-create-object "WScript.shell"))
- ;; 注,在Windows 9x中calc.exe程序不在本示例中的位置,而在"%WINDIR%\\Calc.exe"
- (vlax-invoke-method shell 'run "%WINDIR%\\system32\\Calc.exe" 1 :vlax-true)
- (vlax-invoke-method shell 'run "%COMSPEC% /c copy c:\\aaa.lsp c:\\bbb.lsp" 0 :vlax-false)
- (vlax-release-object shell)
- [/FONT]
|