FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC Printing via Blooth
Posts: 20
Joined: Fri Apr 27, 2012 07:53 AM
Printing via Blooth
Posted: 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
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Printing via Blooth
Posted: Fri May 25, 2012 12:53 AM
This is what I use to print to a POS bluetooth printer:

Code (fw): Select all Collapse
#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)
Posts: 20
Joined: Fri Apr 27, 2012 07:53 AM
Re: Printing via Bluetooth
Posted: Mon May 28, 2012 03:14 AM

Hi Jeff,

Thank you very much. It works.

Thanks again..

Continue the discussion