Solved

Seting default printer

Posted on 2000-04-14
7
148 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
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 17

Accepted Solution

by:
inthe earned 500 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now