Getting system default printer... 
Author Message
 Getting system default printer...

Ty,

I think you will find that you need to read and set this in the
registry.  To find the appropriate key, export the whole registry to a
text file using regedit, change the default printer in windows, export
the registry again, then compare the two registry export files using a
diff utility.  To do this I move the files over to my unix box to do a
diff because it is quick and easy, but I have seen mention of some
windows diff utilities. (windiff I think is one, MKS probably make one
too)  Once you determine the key(s) that change, you must then get and
set the key(s) registry value in your code.

Hope this helps

-Murray
--
=======================================================================
Murray Macdonald                                       http://www.*-*-*.com/
Macdonald Harris and Associates - Vancouver, Canada    Ph. 604.608.0218
Software Development, Web Programming, Database Design, Authoring Tools
=======================================================================



Wed, 21 Jun 2000 03:00:00 GMT  
 Getting system default printer...

I have to disagree with this approach in regards to printers.  The printer
information in the registry is more complicated than in some other areas.

A year or two ago, I wrote an article for one of the Microsoft publications
that explained this topic in depth.  If you query on the MSDN cd on my name
and printer api, you should find it, otherwise try querying on
GetPrinterInfo in the knowledgebase.  These APIs are somewhat complicated
to use since they involve a two step process (calling once to obtain a
structure size then calling again passing this size to the api) and are
best used within a DLL.

Joyce Long



Quote:
> Ty,

> I think you will find that you need to read and set this in the
> registry.  To find the appropriate key, export the whole registry to a
> text file using regedit, change the default printer in windows, export
> the registry again, then compare the two registry export files using a
> diff utility.  To do this I move the files over to my unix box to do a
> diff because it is quick and easy, but I have seen mention of some
> windows diff utilities. (windiff I think is one, MKS probably make one
> too)  Once you determine the key(s) that change, you must then get and
> set the key(s) registry value in your code.

> Hope this helps

> -Murray
> --
> =======================================================================
> Murray Macdonald                                         http://www.mha.ca
> Macdonald Harris and Associates - Vancouver, Canada    Ph. 604.608.0218
> Software Development, Web Programming, Database Design, Authoring Tools
> =======================================================================



Wed, 21 Jun 2000 03:00:00 GMT  
 Getting system default printer...

I'm looking to get the user's system's default printer so that after temporarily
changing it during the program I can set it back to it's original state. I've looked
into the following API's, GetPrivateProfileString and GetProfileString which seem to
be what I want. But I'm not sure what command to send along with it that says bring
back the default printer. All I've been able to accomplish is retrieve all available
printers. How do I limit the search string to return just the default printer.

I read in the KB that the follwing simple code for doing this in VB4 doesn't work:

Dim Ptr As Printer
For Each Prt in Printer
    If Prt Is Printer Then    'Yes this is the default printr
       ...
    End if
Next

Anyway, any help would be appreciated,

                                         Ty



Thu, 22 Jun 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Getting default printer name from Printers Collection

2. Macro to change default printer and then restore original default printer settin

3. printer default to non-default printer

4. How can I change the system-default-printer

5. How to change system's default printer?

6. VB 3.0 and the default-system-printer

7. How can I change the system-default-printer

8. System Wide Default Printer

9. Default system printer

10. Default System Printer

11. Changing system default printer settings

12. How can I change the system-default-printer ?

 

 
Powered by phpBB® Forum Software