How to change windows default printer (delphi 1.0)

How to change windows default printer via delphi 1.0?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


In the system components area there is a Printer Dialog which gives access to all the expected Printer options/settings just add the component to one of your forms and then attach some code to a button to execute the printer dialog.

Now if you require to preform a programmatic change to the default printer - that may be a little more difficult than 50 points would indicate.

I have found another answer to an earlier similar question that may help - it talks about changing the default printer in win31 and refers to WIN API's.

Feel free to have a look at that answer and reject mine if you wish.

olmyAuthor Commented:
Sorry it took so long. There was something wrong with this system -> I could not grade your answer
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

I think that you must use the TPrinter object.
Because, you can use :
 * GetPrinter  to know the list of the Windows printer actually    
 * SetPrinter to assign the printer that you want used.
 For more information, look at the Delphi help file on
TPrinter unit and CreateDC in WIN32 API Help File.




Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
olmyAuthor Commented:
Hi Chova

Are you sure that SetPrinter changes windows default printer?

In online saids "You should seldom, if ever, need to call this method, but instead should access the printer you want in the Printers property array" <- And with Printers property array you can't change the default printer of windows, only the default printer in your own program.
Hi people,
perhaps the Registry could be a good direction to work on it ?
olmyAuthor Commented:
OK, lets try that.
Comment for "itamar" this should work in windows 3.x also.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.