本帖最后由 kingfirekkk 于 2011-6-12 16:52 编辑
操作方法之一见五楼
在坛子里面有看到一个贴子是打印小票的.
求AU3如何直接LPT端口打印或者如何使用VB的CreateObject
http://www.autoitx.com/forum.php ... 8&highlight=LPT
不知道能否对斑马的打印机进行打印操作?
我使用以下源代码,然后将Foxit PDF Printer的端口改至LPT1上面,进行打印测试,没动静...
不知道有哪位兄弟有过类似经验?
代码如下:
#include <WinAPI.au3>
Global $sMessage1="aaa",$sMessage1a="bbb",$sMessage1b="fd",$sName="ff",$sDept="ssD",$sMessage2="tech"
Local $sText = "^XA" & @CRLF & _
"^LH10,10^FS" & @CRLF & _ ; Set label home
"^FWn^FS" & @CRLF & _
"^BY4,3,225^FS" & @CRLF & _
"^FO15,30^ADn,36,40^FD" & $sMessage1 & "^FS" & @CRLF & _
"^FO15,80^ADn,36,40^FD" & $sMessage1a & "^FS" & @CRLF & _
"^FO15,130^ADn,36,40^FD" & $sMessage1b & "^FS" & @CRLF & _
"^FO15,250^ADn,36,20^FD" & $sName & "^FS" & @CRLF & _
"^FO15,300^ADn,36,20^FD" & $sDept & "^FS" & @CRLF & _
"^FO15,380^ADn,36,50^FD" & $sMessage2 & "^FS" & @CRLF & _
"^XZ" & @CRLF
Local $tBuffer = DllStructCreate("char[" & StringLen($sText) & "]")
DllStructSetData($tBuffer, 1, $sText)
Local $nWritten
Local $hFile = _WinAPI_CreateFile("LPT1", 2)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), StringLen($sText), $nWritten)
_WinAPI_CloseHandle($hFile)
|