2012-07-20 108 views
1

我想知道是否有人知道如何使用Visual Basic 6連接到具有TCP/IP接口的熱敏打印機。它將ESC/POS命令發送給打印機,這樣我就可以直接控制它而不需要使用驅動程序。如何在VB6中打開打印機的TCP/IP端口

問題出在第一行;我如何建立與打印機的連接,並給打印機的IP和其他東西,使主機PC /發送電腦與打印機順利通信?

open 
PRINT #1, CHR$(&H1B);"@"; 'Initializes the printer (ESC @) 
PRINT #1, CHR$(&H1B);"a";CHR$(1);'Specifies a centered printing position (ESC a) 
PRINT #1, CHR$(&H1B);"!";CHR$(0); 'Specifies font A (ESC !) 
PRINT #1, "January 14, 2002 15:00"; 
PRINT #1, CHR$(&H1B);"d";CHR$(3); 'Prints and 3 line feeding (ESC d) 
PRINT #1, CHR$(&H1B);"a";CHR$(0); 'Selects the left print position (ESC a) 
PRINT #1, CHR$(&H1B);"!";CHR$(1); 'Selects font B 
PRINT #1, "TM-U210B    $20.00";CHR$(&HA); 
PRINT #1, "TM-U210D    $21.00";CHR$(&HA); 
PRINT #1, "PS-170      $17.00";CHR$(&HA); 
PRINT #1, CHR$(&HA);'Line feeding (LF) 
PRINT #1, CHR$(&H1B);"!";CHR$(17); 'Selects double-height mode 
PRINT #1, "TOTAL     $58.00"; CHR$(&HA); 
PRINT #1, CHR$(&H1B);"!";CHR$(0); 'Cancels double-height mode 
PRINT #1, "------------------------------";CHR$(&HA); 
PRINT #1, "PAID     $60.00";CHR$(&HA); 
PRINT #1, "CHANGE    $ 2.00";CHR$(&HA); 
PRINT #1, CHR$(&H1D);"V";CHR$(66);CHR$(0); 'Feeds paper & cut 

’Drawer Kick (ESC p) 

PRINT #1, CHR$(&H1B); CHR$(&H70); CHR$(&H0); CHR$(60); CHR$(120); 

回答