How to change default printer's Property. 
Author Message
 How to change default printer's Property.

All,

Can anyone provide a working example of how to change default printer's
Property?
Type PRINTDLG
  lStructSize As Long
  hWndOwner As Long
  hDevMode As Long
  hDevNames As Long
  hdc As Long
  flags As Long
  nFromPage As Integer
  nToPage As Integer
  nMinPage As Integer
  nMaxPage As Integer
  nCopies As Integer
  hInstance As Long
  lCustData As Long
  lpfnPrintHook As Long
  lpfnSetupHook As Long
  lpPrintTemplateName As String
  lpSetupTemplateName As String
  hPrintTemplate As Long
  hSetupTemplate As Long
End Type
Public Declare Function PRINTDLG Lib "comdlg32.dll" Alias "PrintDlgA"
(pPrintdlg As PRINTDLG) As Long
'
    Dim B As PRINTDLG
    B.flags = &H40
    B.lStructSize = Len(B)
    PRINTDLG B

Do It, I want change the default printer's Property, but I run it again I
find the default printer's Property no change, why?

Thanks in advance,
--
you friend
Gao Dahua



Tue, 31 Jul 2001 03:00:00 GMT  
 How to change default printer's Property.
Hi Gao,

If I understand your question correctly, you want to display the Printer
dialog with different settings than those for the default printer.
In that case you need to allocate 2 chunks of global memory using
GlobalAlloc() API for the DEVMODE and DEVNAMES structures respectively. Then
you you fill those 2 structure with the printer's info (name, driver and
settings) you want and copy them into the global memory arae you allocated.
Then you assign the handles of the global memory chunks to the hDevMode and
hDevNames members of the PRINTDLG structure respectively.
Now, when you call the PrintDlg() function it will display the info that you
passed in by the DEVMODE and DEVNAMES structures.

If you need some code that does this sent me an E-mail.

Regards,
               Stoil

P.S. And change the declaration of PrintDlg() API so that it is not the same
as the name of the PRINTDLG structure. VB is not case sensitive and its to
confusing, and prone to errors.

Quote:

> All,

> Can anyone provide a working example of how to change default printer's
> Property?
> Type PRINTDLG
>   lStructSize As Long
>   hWndOwner As Long
>   hDevMode As Long
>   hDevNames As Long
>   hdc As Long
>   flags As Long
>   nFromPage As Integer
>   nToPage As Integer
>   nMinPage As Integer
>   nMaxPage As Integer
>   nCopies As Integer
>   hInstance As Long
>   lCustData As Long
>   lpfnPrintHook As Long
>   lpfnSetupHook As Long
>   lpPrintTemplateName As String
>   lpSetupTemplateName As String
>   hPrintTemplate As Long
>   hSetupTemplate As Long
> End Type
> Public Declare Function PRINTDLG Lib "comdlg32.dll" Alias "PrintDlgA"
> (pPrintdlg As PRINTDLG) As Long
> '
>     Dim B As PRINTDLG
>     B.flags = &H40
>     B.lStructSize = Len(B)
>     PRINTDLG B

> Do It, I want change the default printer's Property, but I run it again I
> find the default printer's Property no change, why?

> Thanks in advance,
> --
> you friend
> Gao Dahua



Tue, 31 Jul 2001 03:00:00 GMT  
 How to change default printer's Property.
I means, if user Change the default printer's Property use PRINTDLG, then I
check the default printer's Property, But no change occur, why ?

Hi Gao,

If I understand your question correctly, you want to display the Printer
dialog with different settings than those for the default printer.
In that case you need to allocate 2 chunks of global memory using
GlobalAlloc() API for the DEVMODE and DEVNAMES structures respectively. Then
you you fill those 2 structure with the printer's info (name, driver and
settings) you want and copy them into the global memory arae you allocated.
Then you assign the handles of the global memory chunks to the hDevMode and
hDevNames members of the PRINTDLG structure respectively.
Now, when you call the PrintDlg() function it will display the info that you
passed in by the DEVMODE and DEVNAMES structures.

If you need some code that does this sent me an E-mail.

Regards,
               Stoil

P.S. And change the declaration of PrintDlg() API so that it is not the same
as the name of the PRINTDLG structure. VB is not case sensitive and its to
confusing, and prone to errors.

Quote:

> All,

> Can anyone provide a working example of how to change default printer's
> Property?
> Type PRINTDLG
>   lStructSize As Long
>   hWndOwner As Long
>   hDevMode As Long
>   hDevNames As Long
>   hdc As Long
>   flags As Long
>   nFromPage As Integer
>   nToPage As Integer
>   nMinPage As Integer
>   nMaxPage As Integer
>   nCopies As Integer
>   hInstance As Long
>   lCustData As Long
>   lpfnPrintHook As Long
>   lpfnSetupHook As Long
>   lpPrintTemplateName As String
>   lpSetupTemplateName As String
>   hPrintTemplate As Long
>   hSetupTemplate As Long
> End Type
> Public Declare Function PRINTDLG Lib "comdlg32.dll" Alias "PrintDlgA"
> (pPrintdlg As PRINTDLG) As Long
> '
>     Dim B As PRINTDLG
>     B.flags = &H40
>     B.lStructSize = Len(B)
>     PRINTDLG B

> Do It, I want change the default printer's Property, but I run it again I
> find the default printer's Property no change, why?

> Thanks in advance,
> --
> you friend
> Gao Dahua



Wed, 01 Aug 2001 03:00:00 GMT  
 How to change default printer's Property.
Hi,

The user cannot change the default printer from the Printer dialog.

Are you trying to find out what printer the user selected ( and what are its
settings)?

If so, I have code that does this.

Regards,
               Stoil

Quote:

> I means, if user Change the default printer's Property use PRINTDLG, then I
> check the default printer's Property, But no change occur, why ?


> Hi Gao,

> If I understand your question correctly, you want to display the Printer
> dialog with different settings than those for the default printer.
> In that case you need to allocate 2 chunks of global memory using
> GlobalAlloc() API for the DEVMODE and DEVNAMES structures respectively. Then
> you you fill those 2 structure with the printer's info (name, driver and
> settings) you want and copy them into the global memory arae you allocated.
> Then you assign the handles of the global memory chunks to the hDevMode and
> hDevNames members of the PRINTDLG structure respectively.
> Now, when you call the PrintDlg() function it will display the info that you
> passed in by the DEVMODE and DEVNAMES structures.

> If you need some code that does this sent me an E-mail.

> Regards,
>                Stoil

> P.S. And change the declaration of PrintDlg() API so that it is not the same
> as the name of the PRINTDLG structure. VB is not case sensitive and its to
> confusing, and prone to errors.


> > All,

> > Can anyone provide a working example of how to change default printer's
> > Property?
> > Type PRINTDLG
> >   lStructSize As Long
> >   hWndOwner As Long
> >   hDevMode As Long
> >   hDevNames As Long
> >   hdc As Long
> >   flags As Long
> >   nFromPage As Integer
> >   nToPage As Integer
> >   nMinPage As Integer
> >   nMaxPage As Integer
> >   nCopies As Integer
> >   hInstance As Long
> >   lCustData As Long
> >   lpfnPrintHook As Long
> >   lpfnSetupHook As Long
> >   lpPrintTemplateName As String
> >   lpSetupTemplateName As String
> >   hPrintTemplate As Long
> >   hSetupTemplate As Long
> > End Type
> > Public Declare Function PRINTDLG Lib "comdlg32.dll" Alias "PrintDlgA"
> > (pPrintdlg As PRINTDLG) As Long
> > '
> >     Dim B As PRINTDLG
> >     B.flags = &H40
> >     B.lStructSize = Len(B)
> >     PRINTDLG B

> > Do It, I want change the default printer's Property, but I run it again I
> > find the default printer's Property no change, why?

> > Thanks in advance,
> > --
> > you friend
> > Gao Dahua



Fri, 03 Aug 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Changing Printers property reset printer to Windows default printer

2. How to change default printer's Property by user use PRINTDLG.

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

4. Changing Default Printer Properties

5. Changing printer default properties

6. Changing default printer/properties in NT?

7. Changing default printer/properties in NT?

8. How to change system's default printer?

9. Can't change default printer in VB5

10. Default printer don't change

11. How to change Default Printer In Windows '95 using VB 4.0

12. Change the system's default printer.

 

 
Powered by phpBB® Forum Software