Real Geek Forums  

Go Back   Real Geek Forums > Archives > Operating Systems > Windows XP > Windows XP Device Drivers

Notices

Reply

Changing a printers "global default" settings programatically on WinXP

 

LinkBack Thread Tools Display Modes
Old 02-05-2008, 10:16 AM   #1 (permalink)
Default Re: Changing a printers "global default" settings programatically on WinXP

Hi all

I've done a cross post on this reply tomyself(!) because I cant find an
appropriate group to post this on.

OK i've dug a bit futher an can confirm that when I use GetPrinter to get
the PRINT_INFO_2 data from the printer is the duple mode is set the correct
value is returned

If it is not set the I change the DevMode.dmDuplex value and then pass it
through DocumentProperties

Move
(DocumentProperties(0,hPrinter,AddressOf(sPrinterN ame),ppi2.pDevMode,ppi2.pDevMode,(DM_IN_BUFFER+DM_ OUT_BUFFER)))
to iFlag

When it comes out the other side of this dmDuplex is still set how I set it

I then call SetPrinter with the full PRINT_INFO_2 data and it returns non
zero ie succeeds

Move (SetPrinter(hPrinter,2,pPI2_Data,0)) to iFlag

BUT the duplex value when I go and check in the property panel of the
printer has not changed ????

Any help with this would be greatly appreciated !

Thanks

Andrew


"Andrew Kennard" <b@a.com> wrote in message
news:uK9izi1ZIHA.4172@TK2MSFTNGP02.phx.gbl...
Quote:
> Hi all
>
> Further to my other post I've found some more info on printer settings
> specfically
>
> http://support.microsoft.com/kb/140285
>
> I've converted it so that it works in the language I am using (Visual
> Dataflex) and it appears to be working in that non of the functions return
> errors etc
>
> However having used it to "set" the duplex mode of the printer.
>
> When I go back into "Printers and Faxes" on XP and call up the printers
> properties this setting has not changed ?
>
> Should this have worked ? ie am I doing something wrong ?
>
> Or can it not be done this way and I need to use another method ?
>
> Thanks in advance for your help
>
> Andrew
>
> PS I couldn't seem to find an appropraite newsgroup to post this on so I
> hope these are the two closest !
>

Andrew Kennard
Guest
 
Posts: n/a
Reply With Quote  
Old 02-06-2008, 07:45 AM   #2 (permalink)
Default Re: Changing a printers "global default" settings programatically on WinXP

Well, have you tried peeking at the documentation in the SDK? It sometimes
actually helps.

The keys to your success on setting the global and personal default
settings, are the level 8 and 9 PRINTER_INFO_* structures. Check out the
"SetPrinter" section and the "Per-User DEVMODE" section in the SDK.

Also try reading the "DocumentProperties" section. DocumentProperties has
nothing to do with setting default settings.
If you set duplex in the pDevModeInput it is also set in pDevModeOutput,
unless the printer does not support duplexing. By calling DocumentProperties
you give the driver the opportunity to fix/update/merge the changed members
with those of the driver's internal DEVMODE structure. The call is necessary
since some changes may not work correctly; the printer driver must be called
to correct the DEVMODE structure. When the document is about to be printed,
your application chould pass the merged DEVMODE structure to CreateDC

If you want to set the printer (while printing) to simplex, you should set
the DM_DUPLEX flag and specify DMDUP_SIMPLEX for the dmDuplex member. Or
else the driver will use it's driver internal default duplex setting (which
probably is simplex for standard printer drivers)

--
Christoph Lindemann


"Andrew Kennard" <b@a.com> wrote in message
news:%23hPxKi%23ZIHA.5784@TK2MSFTNGP03.phx.gbl...
Quote:
> Hi all
>
> I've done a cross post on this reply tomyself(!) because I cant find an
> appropriate group to post this on.
>
> OK i've dug a bit futher an can confirm that when I use GetPrinter to get
> the PRINT_INFO_2 data from the printer is the duple mode is set the
> correct value is returned
>
> If it is not set the I change the DevMode.dmDuplex value and then pass it
> through DocumentProperties
>
> Move
> (DocumentProperties(0,hPrinter,AddressOf(sPrinterN ame),ppi2.pDevMode,ppi2.pDevMode,(DM_IN_BUFFER+DM_ OUT_BUFFER)))
> to iFlag
>
> When it comes out the other side of this dmDuplex is still set how I set
> it
>
> I then call SetPrinter with the full PRINT_INFO_2 data and it returns non
> zero ie succeeds
>
> Move (SetPrinter(hPrinter,2,pPI2_Data,0)) to iFlag
>
> BUT the duplex value when I go and check in the property panel of the
> printer has not changed ????
>
> Any help with this would be greatly appreciated !
>
> Thanks
>
> Andrew
>
>
> "Andrew Kennard" <b@a.com> wrote in message
> news:uK9izi1ZIHA.4172@TK2MSFTNGP02.phx.gbl...
Quote:
>> Hi all
>>
>> Further to my other post I've found some more info on printer settings
>> specfically
>>
>> http://support.microsoft.com/kb/140285
>>
>> I've converted it so that it works in the language I am using (Visual
>> Dataflex) and it appears to be working in that non of the functions
>> return errors etc
>>
>> However having used it to "set" the duplex mode of the printer.
>>
>> When I go back into "Printers and Faxes" on XP and call up the printers
>> properties this setting has not changed ?
>>
>> Should this have worked ? ie am I doing something wrong ?
>>
>> Or can it not be done this way and I need to use another method ?
>>
>> Thanks in advance for your help
>>
>> Andrew
>>
>> PS I couldn't seem to find an appropraite newsgroup to post this on so I
>> hope these are the two closest !
>>
>
>

Christoph Lindemann
Guest
 
Posts: n/a
Reply With Quote  
Old 02-06-2008, 09:01 AM   #3 (permalink)
Default Re: Changing a printers "global default" settings programatically on WinXP

Christoph

Thanks VERY much for the pointer !

I was fooled by the KB article entitled "How To Modify Printer Settings by
Using SetPrinter" ..... doesn't actually change anything !

I've now read both your suggested sections (properly!) and provisionally
have got it to work now that i'm doing it correctly !

Would I be correct in assuming that if I use the PRINTER_INFO_9 to change
the personal defaults this would work best with a network shared printer as
opposed to the global PRINTER_INFO_8 ?

Thanks again for all your assistance

Kind Regards

Andrew


"Christoph Lindemann" <clindemann2@newsgroups.nospam> wrote in message
news:eWo1oyJaIHA.208@TK2MSFTNGP02.phx.gbl...
Quote:
> Well, have you tried peeking at the documentation in the SDK? It sometimes
> actually helps.
>
> The keys to your success on setting the global and personal default
> settings, are the level 8 and 9 PRINTER_INFO_* structures. Check out the
> "SetPrinter" section and the "Per-User DEVMODE" section in the SDK.
>
> Also try reading the "DocumentProperties" section. DocumentProperties has
> nothing to do with setting default settings.
> If you set duplex in the pDevModeInput it is also set in pDevModeOutput,
> unless the printer does not support duplexing. By calling
> DocumentProperties you give the driver the opportunity to fix/update/merge
> the changed members with those of the driver's internal DEVMODE structure.
> The call is necessary since some changes may not work correctly; the
> printer driver must be called to correct the DEVMODE structure. When the
> document is about to be printed, your application chould pass the merged
> DEVMODE structure to CreateDC
>
> If you want to set the printer (while printing) to simplex, you should set
> the DM_DUPLEX flag and specify DMDUP_SIMPLEX for the dmDuplex member. Or
> else the driver will use it's driver internal default duplex setting
> (which probably is simplex for standard printer drivers)
>
> --
> Christoph Lindemann
>
>
> "Andrew Kennard" <b@a.com> wrote in message
> news:%23hPxKi%23ZIHA.5784@TK2MSFTNGP03.phx.gbl...
Quote:
>> Hi all
>>
>> I've done a cross post on this reply tomyself(!) because I cant find an
>> appropriate group to post this on.
>>
>> OK i've dug a bit futher an can confirm that when I use GetPrinter to get
>> the PRINT_INFO_2 data from the printer is the duple mode is set the
>> correct value is returned
>>
>> If it is not set the I change the DevMode.dmDuplex value and then pass it
>> through DocumentProperties
>>
>> Move
>> (DocumentProperties(0,hPrinter,AddressOf(sPrinterN ame),ppi2.pDevMode,ppi2.pDevMode,(DM_IN_BUFFER+DM_ OUT_BUFFER)))
>> to iFlag
>>
>> When it comes out the other side of this dmDuplex is still set how I set
>> it
>>
>> I then call SetPrinter with the full PRINT_INFO_2 data and it returns non
>> zero ie succeeds
>>
>> Move (SetPrinter(hPrinter,2,pPI2_Data,0)) to iFlag
>>
>> BUT the duplex value when I go and check in the property panel of the
>> printer has not changed ????
>>
>> Any help with this would be greatly appreciated !
>>
>> Thanks
>>
>> Andrew
>>
>>
>> "Andrew Kennard" <b@a.com> wrote in message
>> news:uK9izi1ZIHA.4172@TK2MSFTNGP02.phx.gbl...
Quote:
>>> Hi all
>>>
>>> Further to my other post I've found some more info on printer settings
>>> specfically
>>>
>>> http://support.microsoft.com/kb/140285
>>>
>>> I've converted it so that it works in the language I am using (Visual
>>> Dataflex) and it appears to be working in that non of the functions
>>> return errors etc
>>>
>>> However having used it to "set" the duplex mode of the printer.
>>>
>>> When I go back into "Printers and Faxes" on XP and call up the printers
>>> properties this setting has not changed ?
>>>
>>> Should this have worked ? ie am I doing something wrong ?
>>>
>>> Or can it not be done this way and I need to use another method ?
>>>
>>> Thanks in advance for your help
>>>
>>> Andrew
>>>
>>> PS I couldn't seem to find an appropraite newsgroup to post this on so I
>>> hope these are the two closest !
>>>
>>
>>
>
>

Andrew Kennard
Guest
 
Posts: n/a
Reply With Quote  
Old 02-07-2008, 08:57 AM   #4 (permalink)
Default Re: Changing a printers "global default" settings programatically on WinXP

"Andrew Kennard" <b@a.com> wrote in message
news:%23w9IycKaIHA.5900@TK2MSFTNGP02.phx.gbl...
Quote:
> Would I be correct in assuming that if I use the PRINTER_INFO_9 to change
> the personal defaults this would work best with a network shared printer
> as opposed to the global PRINTER_INFO_8 ?
I actually do not know. My best suggestion is to try it. Make sure to test
from an account that is NOT administrator.
Some thoughts:
As a normal user, you might only have access to set your personal settings.
When changing the global settings (level 8) it will change the "global"
settings on your local machine (I think), but it might also be that the
global settings are changed on the server (the machine where the printer is
attached) globally. Also there might be a difference depending on if the
global settings are set from a local administrator or domain
administrator....

Quote:
> Thanks again for all your assistance
You are welcome.

Regards,
Christoph


Christoph Lindemann
Guest
 
Posts: n/a
Reply With Quote  
Reply

Tags
None

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Changing default path of "My Documents" (User files)to D: drive? math Windows Vista File Management 4 07-17-2007 12:12 AM
changing a users "default" directory. Bruce Bowler Windows XP Configuration & Management 2 01-12-2005 12:19 PM
How do I get the "Username" and "Password" prompt when connecting to other WINXP computers on my home network? Doug Williams Windows XP Work Remotely 1 01-28-2004 10:47 AM
Changing default location of "Documents and Settings Folder" GMB Windows XP Basics 2 07-24-2003 02:37 AM
Changing default directory for "Documents and Settings" folder Keith Windows XP Setup 0 07-16-2003 10:10 PM


All times are GMT. The time now is 01:29 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright © 2005 - 2007 RealGeek.com. All rights reserved.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90