請教怎麼用程序實現與DOS輸入一樣的功能?急!
我有一個TXT文檔,是一些打印機的設置,我想程序怎次運行的時候就將這個TXT文檔上的內容複製到我的打印機的內部設置裏。我在DOS裏執行 copy c:\print.txt prn就可以實現我的功能。有這樣的一個API嗎?或者怎樣自動在程序執行是調用DOS執行這條命令?
shell cmd.exe能調出DOS窗口,但之後的命令要怎麼執行呢?(命令是固定的)
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Form_Load()
Dim FileLink As Long
FileLink = FreeFile
Open "C:\Test.txt" For Append As #FileLink
Print #FileLink, "打印测试"
Close #FileLink
ShellExecute 0, "open", "Notepad.exe ", "/p C:\test.txt", "C:\", 1 '将C:\test.txt 改成你要打印的文件名。
End Sub
‘
[此贴子已经被作者于2007-1-7 12:45:47编辑过]