Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Good day! I have a problem with printing image. How I must fill this function?
WriteFile(serial_port, (void *)argv[1], file_name_size, &bytes_written, NULL);

Please give me an example.
Posted
Updated 30-May-10 23:03pm
v2

Agrafena wrote:
Please give me an example.


An example of what? Please explain what you are trying to do. The title says send an image on com port and your comment says you have a problem with printing.
 
Share this answer
 
I print a document with picture. My printeris based on RS232 interface. I connect with COM1 port and send date. I need example of manipulation with image.
 
Share this answer
 
Comments
Richard MacCutchan 31-May-10 7:59am    
If you are doing it this way then you will need to send all the control codes to your printer to render your image. Much better to use the built in print support in Windows.
You shouldn't access the serial port directly. You have to use the higher level functions from Windows to print. They make abstraction of which type of printer is connected (and how it is connected).

Take a look at this section[^] on codeproject to look for a suitable article for your needs.
 
Share this answer
 
I'm sorry, but there are not full answer. How can I create a Bitmap object(black/white)-by CreateCompatibleBitmap function? But how I can sent it to print?
 
Share this answer
 
v2
One simple way would be to call ShellExecute[^] with the 'print' verb.

That requires you to first save your image to a file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900