It is currently Wed Aug 22, 2018 6:41 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Sending characters to Olivetti PR2 RS232 dotmatrix printer
PostPosted: Thu Apr 19, 2018 12:53 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue May 28, 2013 10:51 pm
Posts: 527
Location: Europe
Greetings,

I have a printer that works in Olivetti PR2 emulation. It is connected to COM4 port on Windows.

Following commands work from Windows CLI.

Code:
set /p x="some text" <nul >\\.\COM4

Code:
type somefile.txt >\\.\COM4


Printing works via Print dialogue in PureBasic as well, however...

Is there a possibility to "emulate" commands above, since printer than works in native mode and not (very slow and nonflexible) graphics mode when I print it via Print library in PB? Can I use StartPrinting() function with some "native" mode for such dot-matrix printers?

BTW, i CANNOT access COM4 port from PB's commands...

Thank you in advance,

Bruno

Edit: I tried something like this, but compiler crushes...

Code:
txt.s = "0123456789"
hndl.i = CreateFile_("\\.\COM4", #GENERIC_ALL, #FILE_SHARE_READ, #Null, #OPEN_EXISTING, #Null, #Null)
WriteFile_(hndl, @txt, Len(txt), #Null, #Null)
CloseHandle_(hndl)


Code:
Problem signature:
  Problem Event Name:   APPCRASH
  Application Name:   PureBasic_Compilation0.exe
  Application Version:   0.0.0.0
  Application Timestamp:   5ad88724
  Fault Module Name:   KERNELBASE.dll
  Fault Module Version:   6.1.7601.23915
  Fault Module Timestamp:   59b94f2a
  Exception Code:   c0000005
  Exception Offset:   0000000000001b54
  OS Version:   6.1.7601.2.1.0.256.1
  Locale ID:   1050
  Additional Information 1:   6b14
  Additional Information 2:   6b148cf49d296fa0cbd4faef530b5e86
  Additional Information 3:   500e
  Additional Information 4:   500eec2a859faeef979f97032c85988a

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.txt


WriteFile_ part seems to be the one causing the error.

Solution

http://www.purebasic.fr/german/viewtopic.php?f=3&t=1152

_________________
"If you lie to the compiler, it will get its revenge."
Henry Spencer
https://www.pci-z.com/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye