这样的,我有个文本文件是text.txt放在D盘,有一个功能是这样实现的.
从电脑的开始-运行-cmd-输入copy d:\text.txt lpt1 回车就可以实现,(其中lpt1是指电脑的lpt1接口)
我想用VB来实现这个功能,但不知道怎么写.请高手指教.谢谢了.

解决方案 »

  1.   

    是打印吗?
    是的话:
    Option ExplicitPrivate 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 LongPrivate Sub Command1_Click()
     ShellExecute Me.hwnd, "print", "d:\text.txt", vbNullString, vbNullString, 1
    End Su
      

  2.   

    或者:
    shell "cmd /c copy d:\text.txt lpt1"
      

  3.   

    使用Vb shell 函数
    shell"cmd /c 加上dos指令“
    shell "cmd /c copy d:\text.txt lpt1"
      

  4.   

    Private Sub Command1_Click()
    ShellExecute Me.hwnd, "print", "d:\text.txt", vbNullString, vbNullString, 1
    End Sub