using printer with an app

Discussion about everything. New games, 3d math, development tips...
Post Reply
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

using printer with an app

Post by shadowslair »

Hi!
While working on some small side project I need my app to use the printer. Like when the user presses a button a certain message or image will be printed on a sheet of paper.

So my question is whether somebody of you ever did sth similar, and what will be the easiest way for a non-windows progrmmer to do the job? Should I use some SDK, or I can use some windows functions?

The output doesn`t need to be edited, previewed etc. Like just press a button and a few lines will be printed directly. App is in C++ and Irrlicht, platform should support WinXP at least.

I think it`ll need to be sth like this:
1) On app startup- set the port, Init the printer, get some pointer maybe?
2) call myDefaultPrinter->printMyMessage("Hello, ugly printer world! This is me on a sheet of paper!");

Any ideas?! :roll:
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Lil Margin
Posts: 212
Joined: Sun Jul 19, 2009 4:24 am
Location: Netherlands Antilles, Curacao

Post by Lil Margin »

download visual c++ and make a win32 application, i think it comes with printer functions inbuild and the rest of the stuff you want you can look refrences up at http://www.planet-source-code.com/
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

Thanks, will look at that link. In fact, I already did what I needed using the parallel port "LPT1" and redirecting to the USB port. Will try some more elegant solutions though...

EDIT: In either case I`m using Visual 2008. :)
Last edited by shadowslair on Wed Nov 10, 2010 10:31 pm, edited 2 times in total.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

Lil Margin wrote:download visual c++ and make a win32 application, i think it comes with printer functions inbuild and the rest of the stuff you want you can look refrences up at http://www.planet-source-code.com/
Win32 applications don't come with printer code, unless you're talking about .NET projects, at which point you should probably be using C# (I've never seen the point of using C++.NET when there's a higher level alternative that compiles to the same intermediate code).

Shadowslair, printing is an OS specific task. What operating system are you coding for?
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

slavik262 wrote:Shadowslair, printing is an OS specific task. What operating system are you coding for?
Coding for Win XP, as I stated in the first post. But I think I achieved what I needed, at least for the time being- printing sth like a log file. But you`re right- I`ll need to find some "more elegant" solution and read a bit about it. Anyway, thank you both for the quick answer. :wink:
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Post Reply