Printing via Blooth

Printing via Blooth

Postby cllow208 » Fri May 04, 2012 10:04 am

Can somebody kindly help please? :)

I need to print to a BLUE Tooth port COM6, using the posted examples , I got error messages on defination
GENERIC_WRITE, which header files i need for definations: GENERIC_WRITE, OPEN_EXISTING and FILE_ATTRIBUTE_NORMAL ??

Thanks again...

best regards,
CL Low


hOut := CreateFile( "COM6:",GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL )
IF hOut==-1
MsgStop("Port Impression non trouvé, Impression Impossible")
ELSE
FOR i = 1 TO Len( cText )
//WriteByte( hOut, Asc(SubStr( cText, i, 1 ) ) )
WriteByte( hOut, SubStr( cText, i, 1 ) )
SysRefresh()
NEXT

CloseHandle( hOut )
MsgStop("Port send successfully")
endif
cllow208
 
Posts: 20
Joined: Fri Apr 27, 2012 7:53 am

Re: Printing via Blooth

Postby Jeff Barnes » Fri May 25, 2012 12:53 am

This is what I use to print to a POS bluetooth printer:

Code: Select all  Expand view


#define GENERIC_WRITE         0x40000000
#define OPEN_EXISTING         3
#define FILE_ATTRIBUTE_NORMAL 0x00000080

Function BluePrint()
    Local cPrnCom:="COM6:"
    Local i, hOut, cStrip:=""
    cStrip += "This is a test"+ CRLF + CRLF
    cStrip += "*****End of Report****"+CRLF
    cStrip += CRLF + CRLF + CRLF +CHR(27)+"J"   

    hOut := CreateFile( cPrnCom,GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL )
    IF hOut==-1
       MsgStop("xxxxxx error Port not found")
        ELSE
       FOR i = 1 TO Len( cStrip )
          WriteByte( hOut, Asc(SubStr( cStrip, i, 1 ) ) )
       NEXT
      syswait(2)
      CloseHandle( hOut )
    ENDIF
Return Nil
 
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Printing via Bluetooth

Postby cllow208 » Mon May 28, 2012 3:14 am

Hi Jeff,

Thank you very much. It works.

Thanks again..
cllow208
 
Posts: 20
Joined: Fri Apr 27, 2012 7:53 am


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 6 guests