?
Solved

Seting default printer

Posted on 2000-04-14
7
Medium Priority
?
157 Views
Last Modified: 2010-04-04
Hello,
 Here is my question : How can i set dynamicaly the Window's default printer ?

Here is the situation : My customer has 2 printers : 1 Epson (Dot-Matrix), and 1 Cannon (Ink jet). He needs both. I plugged an Hardware switch, but now i need something like an software switch.

Thanks for all ideas.

Note : points will be upgraded up to 500 for an answer today.
0
Comment
Question by:helpme020897
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 

Author Comment

by:helpme020897
ID: 2715690
Second note : Programs using printers are not mine...   so i can do nothing inside those programms...

         HelpMe
0
 
LVL 9

Expert Comment

by:ITugay
ID: 2715773
Try to search PAQ in this topic area "set default printer", there are good answers avalable for 1 or 3 points only.
-----
Igor.
0
 
LVL 4

Expert Comment

by:Radler
ID: 2716053
A software switch is a expensive product.
To the future and analising the local resources buy a USB printer or a net ( Expensive too, but with some advantages ).

T++, Radler.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Accepted Solution

by:
inthe earned 2000 total points
ID: 2716538
Uses Printers;

var Printlist:TStringlist;
    i:integer;
begin
   PrintList:=Tstringlist.create;
   PrintList.AddStrings(Printer.Printers);
   For i:=0 to Printlist.Count-1 do
begin
     if uppercase(Printlist.Strings[i])='STYLUS COLOR 600' then
     begin
        Printer.PrinterIndex:=i;
        exit;    
     end;
end;
   showmessage('Error finding printers');
end;




or:

you can also change the default one like so:



var
Device : array[0..255] of char;
Driver : array[0..255] of char;
Port : array[0..255] of char;
hDeviceMode: THandle;
begin
Printer.PrinterIndex := 1; //or 2 etc
Printer.GetPrinter(Device, Driver, Port, hDeviceMode);
StrCat( Device, ',');
StrCat( Device, Driver );
StrCat( Device, ',');
StrCat( Device, Port );
WriteProfileString( 'windows', 'device', Device );
StrCopy( Device, 'windows' );
SendMessage( HWND_BROADCAST, WM_WININICHANGE, 0, longint( @Device ));
0
 
LVL 4

Expert Comment

by:mhervais
ID: 2722743
listening
0
 

Author Comment

by:helpme020897
ID: 2723645
Adjusted points from 200 to 500
0
 

Author Comment

by:helpme020897
ID: 2723646
thanks a lot
    HelpME
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question