Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #12768 > unrolled thread

Changing a default printer in application

Started byKrystian <softb@softb.pl>
First post2020-01-09 11:07 -0800
Last post2020-01-11 08:11 +0100
Articles 6 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Changing a default printer in application Krystian <softb@softb.pl> - 2020-01-09 11:07 -0800
    Re: Changing a default printer in application Peter Tilsted <peter.tilsted@visma.com> - 2020-01-09 23:34 -0800
    Re: Changing a default printer in application Krystian <softb@softb.pl> - 2020-01-10 02:21 -0800
      Re: Changing a default printer in application Peter Tilsted <peter.tilsted@visma.com> - 2020-01-10 05:58 -0800
    Re: Changing a default printer in application Krystian <softb@softb.pl> - 2020-01-10 10:08 -0800
    Re: Changing a default printer in application "Karl-Heinz" <invalid@invalid.invalid> - 2020-01-11 08:11 +0100

#12768 — Changing a default printer in application

FromKrystian <softb@softb.pl>
Date2020-01-09 11:07 -0800
SubjectChanging a default printer in application
Message-ID<94896974-7188-415a-bf4a-66e5bd0bee79@googlegroups.com>
Hi,

Please help me to solve the problem of changing the default printer before executing printing from an application.
First i change the printer by a button : (Drukarka = printer)
	IF SELF:Drukarka:IsValid()
		SELF:Drukarka:SetUp()
	ENDIF
then i create the pdf file and print it using 	
PrintFile(SELF:hWnd, SELF:File_Name) - it goes thru the Adobe Reader.
The problem is, that it goes to the old, previous printer - (MS Print to PDF) or
prints nothing. How should i effectively change the printer ?

2.
I change the default printer in OS before running application and try to print in duplex mode :
	LOCAL wdm AS _WinDevMode
	wdm := drukarka:GetDevMode()
	wdm.dmDuplex := DMDUP_VERTICAL
	drukarka:UpdateDevMode()
but it still prints simplex.
What should i do more to receive a double sided printout ?

3.
How can i check from inside the application that the printer is able to print in duplex mode ?

Thanks in advance
Krystian

[toc] | [next] | [standalone]


#12770

FromPeter Tilsted <peter.tilsted@visma.com>
Date2020-01-09 23:34 -0800
Message-ID<39482bbd-8db1-4227-9a80-307bd3857853@googlegroups.com>
In reply to#12768
torsdag den 9. januar 2020 kl. 20.07.16 UTC+1 skrev Krystian:
> Hi,
> 
> Please help me to solve the problem of changing the default printer before executing printing from an application.
> First i change the printer by a button : (Drukarka = printer)
> 	IF SELF:Drukarka:IsValid()
> 		SELF:Drukarka:SetUp()
> 	ENDIF
> then i create the pdf file and print it using 	
> PrintFile(SELF:hWnd, SELF:File_Name) - it goes thru the Adobe Reader.
> The problem is, that it goes to the old, previous printer - (MS Print to PDF) or
> prints nothing. How should i effectively change the printer ?
> 
> 2.
> I change the default printer in OS before running application and try to print in duplex mode :
> 	LOCAL wdm AS _WinDevMode
> 	wdm := drukarka:GetDevMode()
> 	wdm.dmDuplex := DMDUP_VERTICAL
> 	drukarka:UpdateDevMode()
> but it still prints simplex.
> What should i do more to receive a double sided printout ?
> 
> 3.
> How can i check from inside the application that the printer is able to print in duplex mode ?
> 
> Thanks in advance
> Krystian

Hi Krystian

to communicate with the printer setup you have to use the a windows API called the Print Spooler API

read more here: https://docs.microsoft.com/en-us/windows/win32/printdocs/print-spooler-api

regards

Peter

[toc] | [prev] | [next] | [standalone]


#12771

FromKrystian <softb@softb.pl>
Date2020-01-10 02:21 -0800
Message-ID<1adf01be-db61-425f-9e7f-33132f23d03b@googlegroups.com>
In reply to#12768
Hi Peter,

Thank you for answer and suggestion. It is quite new approach and i need some time to check this way. But from the other hand, i am astonished at the degree of complication of such simple situation. Up to now i use my method to setting up the width and length of paper and it works without any problem. Why can't i control duplex printing this same way ?

Once again thank you very much
With regards
Krystian

W dniu czwartek, 9 stycznia 2020 20:07:16 UTC+1 użytkownik Krystian napisał:
> Hi,
> 
> Please help me to solve the problem of changing the default printer before executing printing from an application.
> First i change the printer by a button : (Drukarka = printer)
> 	IF SELF:Drukarka:IsValid()
> 		SELF:Drukarka:SetUp()
> 	ENDIF
> then i create the pdf file and print it using 	
> PrintFile(SELF:hWnd, SELF:File_Name) - it goes thru the Adobe Reader.
> The problem is, that it goes to the old, previous printer - (MS Print to PDF) or
> prints nothing. How should i effectively change the printer ?
> 
> 2.
> I change the default printer in OS before running application and try to print in duplex mode :
> 	LOCAL wdm AS _WinDevMode
> 	wdm := drukarka:GetDevMode()
> 	wdm.dmDuplex := DMDUP_VERTICAL
> 	drukarka:UpdateDevMode()
> but it still prints simplex.
> What should i do more to receive a double sided printout ?
> 
> 3.
> How can i check from inside the application that the printer is able to print in duplex mode ?
> 
> Thanks in advance
> Krystian

[toc] | [prev] | [next] | [standalone]


#12772

FromPeter Tilsted <peter.tilsted@visma.com>
Date2020-01-10 05:58 -0800
Message-ID<70efc7da-779b-49a8-9973-dceb9fef6e2c@googlegroups.com>
In reply to#12771
fredag den 10. januar 2020 kl. 11.21.40 UTC+1 skrev Krystian:
> Hi Peter,
> 
> Thank you for answer and suggestion. It is quite new approach and i need some time to check this way. But from the other hand, i am astonished at the degree of complication of such simple situation. Up to now i use my method to setting up the width and length of paper and it works without any problem. Why can't i control duplex printing this same way ?
> 
> Once again thank you very much
> With regards
> Krystian
> 
> W dniu czwartek, 9 stycznia 2020 20:07:16 UTC+1 użytkownik Krystian napisał:
> > Hi,
> > 
> > Please help me to solve the problem of changing the default printer before executing printing from an application.
> > First i change the printer by a button : (Drukarka = printer)
> > 	IF SELF:Drukarka:IsValid()
> > 		SELF:Drukarka:SetUp()
> > 	ENDIF
> > then i create the pdf file and print it using 	
> > PrintFile(SELF:hWnd, SELF:File_Name) - it goes thru the Adobe Reader.
> > The problem is, that it goes to the old, previous printer - (MS Print to PDF) or
> > prints nothing. How should i effectively change the printer ?
> > 
> > 2.
> > I change the default printer in OS before running application and try to print in duplex mode :
> > 	LOCAL wdm AS _WinDevMode
> > 	wdm := drukarka:GetDevMode()
> > 	wdm.dmDuplex := DMDUP_VERTICAL
> > 	drukarka:UpdateDevMode()
> > but it still prints simplex.
> > What should i do more to receive a double sided printout ?
> > 
> > 3.
> > How can i check from inside the application that the printer is able to print in duplex mode ?
> > 
> > Thanks in advance
> > Krystian

I may stand corrected, sorry about that, it is a long time ago that i used VO, and in my current setup, we use the spool api instead of DevMode

but since that is what is being offered from within VO (now i checked the documentation :-) ) it should be done that way, but that i have no experience in

this article talks about duplex:
https://support.microsoft.com/en-ie/help/167345/how-to-modify-printer-settings-with-the-documentproperties-function

this about setting default printer
https://support.microsoft.com/en-us/help/140285/how-to-modify-printer-settings-by-using-setprinter

[toc] | [prev] | [next] | [standalone]


#12773

FromKrystian <softb@softb.pl>
Date2020-01-10 10:08 -0800
Message-ID<9546e470-cd2f-4e9c-ab26-d391489472c8@googlegroups.com>
In reply to#12768
W dniu czwartek, 9 stycznia 2020 20:07:16 UTC+1 użytkownik Krystian napisał:
> Hi,
> 
> Please help me to solve the problem of changing the default printer before executing printing from an application.
> First i change the printer by a button : (Drukarka = printer)
> 	IF SELF:Drukarka:IsValid()
> 		SELF:Drukarka:SetUp()
> 	ENDIF
> then i create the pdf file and print it using 	
> PrintFile(SELF:hWnd, SELF:File_Name) - it goes thru the Adobe Reader.
> The problem is, that it goes to the old, previous printer - (MS Print to PDF) or
> prints nothing. How should i effectively change the printer ?
> 
> 2.
> I change the default printer in OS before running application and try to print in duplex mode :
> 	LOCAL wdm AS _WinDevMode
> 	wdm := drukarka:GetDevMode()
> 	wdm.dmDuplex := DMDUP_VERTICAL
> 	drukarka:UpdateDevMode()
> but it still prints simplex.
> What should i do more to receive a double sided printout ?
> 
> 3.
> How can i check from inside the application that the printer is able to print in duplex mode ?
> 
> Thanks in advance
> Krystian

Hi Peter,

Thank you for Your effort and so detailed answer and Your will to share Your experience and knowledge.
I have not the best opinion about VO and i think, that using directly api win is more effective and faster.

With regards
Krystian

With

[toc] | [prev] | [next] | [standalone]


#12777

From"Karl-Heinz" <invalid@invalid.invalid>
Date2020-01-11 08:11 +0100
Message-ID<h7tavhFcj42U1@mid.individual.net>
In reply to#12768
Hi Krystian,

>> I change the default printer in OS before running application and try to
>> print in duplex mode :
>> LOCAL wdm AS _WinDevMode
>> wdm := drukarka:GetDevMode()
>> wdm.dmDuplex := DMDUP_VERTICAL
>> drukarka:UpdateDevMode()
>> but it still prints simplex.
>>What should i do more to receive a double sided printout ?
>>
>> how can i check from inside the application that the printer is able to
>> print in duplex mode ?
>>

from my understanding you must check the dmFields member if duplex is
supported.


LOCAL wdm AS _WINDEVMODE
wdm := drukarka:GetDevMode()

IF _AND ( wdm.dmFields , DM_DUPLEX ) == DM_DUPLEX

     ? "Duplex supported"

      wdm.dmDuplex := DMDUP_VERTICAL

ELSE

     ? "Duplex not supported"

ENDIF


drukarka:UpdateDevMode()


regards
Karl-Heinz

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web