How to code a fake print driver/queue

Red Squirrel

No Lifer
May 24, 2003
69,974
13,474
126
www.anyf.ca
I want to make a special "print queue" where when a print job is sent to it, the user would get a message in a dialog box or message box. How would I go about making this act as a printer?

Basically what I want to do is set this printer as default for everybody, so when they just hit "print" without bothering to select a printer, it would pop up at them telling them to go file/print and select a printer. Maybe I could even add instructions on how they can set a default, and then it would reset when they log off.
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Why not let users set their own default printer? What problem are you trying to solve?
 

Red Squirrel

No Lifer
May 24, 2003
69,974
13,474
126
www.anyf.ca
Most people here arn't really educated on how the whole default printer thing works, they just hit print and assume it will go to the right printer, then log a help desk call because "the printer is not working". one day it works, then someone comes along and changes the default (there's lot of shared computers) and t hen it "breaks" the printer for the next user because they don't bother checking where their job is going to go.

So I just want to force users to go to file / print. I will let them choose it for their session but it will revert back when they log off. With the app I might go a step further and have a box show up that lists all the printers then they can choose the default there, but not sure yet. I don't know much about GUI coding so I'll have to research that part myself, just have no idea how to make my app start when a user prints to a specific printer.
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
You could use a login script to set the users' default printers correctly.
 

Red Squirrel

No Lifer
May 24, 2003
69,974
13,474
126
www.anyf.ca
You could use a login script to set the users' default printers correctly.

That's how it is now, and it's a real mess. We want to get away from that. It's actually through a program called desktop authority, and whoever previously set it up really did not organize it correctly. Different users want different defaults, and they switch computers all the time and want different defaults depending on what computer their at etc... so it's just easier to get users to pick their own defaults, or just select what printer to print to.

What I have in mind is push this fake printer as default but when it comes up it would allow them to pick a default from there, maybe. I just don't know how to register an app as a printer. Basically I want to emulate what pdf creator does but instead of creating a pdf, it pops up my message.
 

theevilsharpie

Platinum Member
Nov 2, 2009
2,322
14
81
I had a similar problem with a client. Employees roamed around a lot and had roaming profiles, so they didn't always have the correct printers.

High employee turnover made user training difficult, so I resolved this problem by writing a script that decoded the computer name (our computer naming scheme was based on the PC's location), and then added a group of physically close printers and assigned the appropriate default. It probably wasn't the most efficient way to resolve this problem, but it worked well as long as the IT staff kept the computer names up to date.

If you're using Windows, you can also use IIS's web-based printing functionality to solve this problem. IIS comes with a generic printer selection page, but you can customize it to suit your needs. Other OS's should have similar functionality.
 

Red Squirrel

No Lifer
May 24, 2003
69,974
13,474
126
www.anyf.ca
I've seen this done at the college I go to, so I'm sure there must be a way. Theirs did not start a program though, but if you clicked it nothing happened, and upon hover it would say "please select a printer to print to" or something.
 

Modelworks

Lifer
Feb 22, 2007
16,240
7
76
If they are not using 64 bit OS you can write a printer driver really easily using C++ . Download the MS DDK . Then just make it as the default printer with preview, that allows you to use the same spool buffer for the data then just direct it to the printer of choice. Similar to doing something like this.

User clicks print.
Dialog appears showing the pages and information like a normal printer, then they select where to print to and click print.

There are other ways to do it to with AutoIt. It is a scripting language for controlling primarily windows functions. You could script it to check for a message sent to the spool and intercept it and redirect to where you like.
http://www.autoitscript.com/autoit3/
 

Red Squirrel

No Lifer
May 24, 2003
69,974
13,474
126
www.anyf.ca
If they are not using 64 bit OS you can write a printer driver really easily using C++ . Download the MS DDK . Then just make it as the default printer with preview, that allows you to use the same spool buffer for the data then just direct it to the printer of choice. Similar to doing something like this.

User clicks print.
Dialog appears showing the pages and information like a normal printer, then they select where to print to and click print.

There are other ways to do it to with AutoIt. It is a scripting language for controlling primarily windows functions. You could script it to check for a message sent to the spool and intercept it and redirect to where you like.
http://www.autoitscript.com/autoit3/

Yeah that's pretty much what I want to do, and C++ would be the preferred language so it's a single exe, and I guess I need to register it as a printer somehow, which is the part I'm really not sure how to do.