How to OPEN native PRINTER DIALOG -- Please HELP !!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pamelafluente@libero.it

    #1

    How to OPEN native PRINTER DIALOG -- Please HELP !!

    I am doing my own PrintDialog, and have placed there a combo with the
    printer names, as in the PrintDialog provided by VB.NET.

    Here is the question: how do I open the native windows printer dialog
    for the current printer, so that my current
    PrintDocument.P rinterSettings will be set according to the User choices
    ?

    Thanks
    -Pamela


    My question in code. Assume you have ceated a MyPrintDialog
    form with a combo box "ComboBoxPrinte rNames" listing the printers and a
    button "ButtonSelected PrinterProperti es"
    to set the current printer properties.

    ---------------------------------------
    Private Sub ButtonSelectedP rinterPropertie s_Click(ByVal sender As
    System.Object, ByVal e As System.EventArg s) Handles
    ButtonSelectedP rinterPropertie s.Click

    Me.PrintDocumen t.PrinterSettin gs.PrinterName =
    Me.ComboBoxPrin terNames.Select edText
    If Not Me.PrintDocumen t.PrinterSettin gs.IsValid Then
    MsgBox("Invalid printer", MsgBoxStyle.Inf ormation)
    Exit Sub
    End If

    Me.OpenPrinterP ropertiesDialog (PrintDocument)
    End Sub

    Sub OpenPrinterProp ertiesDialog(By Val PrintDocument As
    PrintDocument)

    ' ???????? my question: how to open the windows dialog for
    setting PrintDocument.P rinterSettings

    End Sub
    --------------------------------------------

  • Bart Mermuys

    #2
    Re: How to OPEN native PRINTER DIALOG -- Please HELP !!

    Hi,

    <pamelafluente@ libero.it> wrote in message
    news:1130762407 .959366.143190@ o13g2000cwo.goo glegroups.com.. .[color=blue]
    >I am doing my own PrintDialog, and have placed there a combo with the
    > printer names, as in the PrintDialog provided by VB.NET.
    >
    > Here is the question: how do I open the native windows printer dialog
    > for the current printer, so that my current
    > PrintDocument.P rinterSettings will be set according to the User choices
    > ?
    >
    > Thanks
    > -Pamela
    >
    >
    > My question in code. Assume you have ceated a MyPrintDialog
    > form with a combo box "ComboBoxPrinte rNames" listing the printers and a
    > button "ButtonSelected PrinterProperti es"
    > to set the current printer properties.
    >
    > ---------------------------------------[/color]

    Without much guarantee though it should be possible with a few native
    functions:

    Public Class YourPrinterSett ingsDialog
    ' native functions
    Private Declare Auto Function GlobalLock Lib "kernel32.d ll" _
    (ByVal handle As IntPtr) As IntPtr
    Private Declare Auto Function GlobalUnlock Lib "kernel32.d ll" _
    (ByVal handle As IntPtr) As Integer
    Private Declare Auto Function GlobalFree Lib "kernel32.d ll" _
    (ByVal handle As IntPtr) As IntPtr
    Private Declare Auto Function DocumentPropert ies Lib "winspool.d rv" _
    (ByVal hWnd As IntPtr, ByVal hPrinter As IntPtr, _
    ByVal pDeviceName As String, ByVal pDevModeOutput As IntPtr, _
    ByVal pDevModeInput As IntPtr, ByVal fMode As Int32) As Integer


    Private Sub ButtonSelectedP rinterPropertie s_Click( ... )...
    ' only change PrinterName when it is required, NOT each time the user
    presses
    ' the button, setting a printername resets some of the settings
    If (ComboBoxPrinte rNames.Selected Index <> -1) Then
    If (Me.PrintDocume nt.PrinterSetti ngs.PrinterName <>
    ComboBoxPrinter Names.Text) Then
    Me.PrintDocumen t.PrinterSettin gs.PrinterName =
    ComboBoxPrinter Names.Text
    End If
    If Me.PrintDocumen t.PrinterSettin gs.IsValid Then
    Me.OpenPrinterP ropertiesDialog (PrintDocument. PrinterSettings )
    Else
    MsgBox("Invalid printersettings ", MsgBoxStyle.Inf ormation)
    End If
    Else
    MsgBox("Choose a printer", MsgBoxStyle.Inf ormation)
    End If
    End Sub

    Sub OpenPrinterProp ertiesDialog(By Val Settings As PrinterSettings )
    ' PrinterSettings +PageSettings -> hDEVMODE
    Dim hDevMode As IntPtr = _
    Settings.GetHde vmode(Settings. DefaultPageSett ings)

    ' Show Dialog ( [In,Out] pDEVMODE )
    Dim pDevMode As IntPtr = GlobalLock(hDev Mode)
    DocumentPropert ies(Me.Handle, IntPtr.Zero, _
    Settings.Printe rName, pDevMode, pDevMode, 14)
    GlobalUnlock(hD evMode)

    ' hDEVMODE -> PrinterSettings +PageSettings
    Settings.SetHde vmode(hDevMode)
    Settings.Defaul tPageSettings.S etHdevmode(hDev Mode)

    ' cleanup
    GlobalFree(hDev Mode)
    End Sub

    End Class

    HTH,
    Greetings


    Comment

    • pamelafluente@libero.it

      #3
      Re: How to OPEN native PRINTER DIALOG -- Please HELP !!

      Dear Bart,

      Really THANK YOU VERY MUCH !!! for your contribution.

      You also provide some additional advice. Let me study and try to
      implement it.

      This one is very important for my work. Infact the PrintDialog provided
      with .NET is too primitive
      to be useful in real programs, and once one rewrite one cannot escape
      the task to manually call the printer setup.

      I will work on it and will probably poput later with some question, in
      case I have problems.

      I am very grateful,

      -Pamela

      Comment

      • pamelafluente@libero.it

        #4
        Re: How to OPEN native PRINTER DIALOG -- Please HELP !!

        Dear Burt,

        I have tried your code (on XP). Actually it is quite complete. You
        have practically
        done the all job. I also appreciated your correction about setting
        the printer name.
        You are really an angel!

        I have not tried yet to print because now its night here and I am
        not at my office,
        but the printer properties dialog pops up fine. In case of problems
        I will tell you.

        If I may, I would need some further info for some refinements.
        I am loading the printer names in a combo (or perhaps I will use a
        treeview):
        with something like:

        -------------------------------------
        Private Sub YourPrinterSett ingsDialog_Load (ByVal sender...) Handles
        MyBase.Load

        Dim PrinterNames As New ArrayList
        For Each PrinterName As String In
        PrinterSettings .InstalledPrint ers
        Try
        PrinterNames.Ad d(PrinterName)
        Catch
        End Try
        Next PrinterName
        Me.ComboBoxPrin terNames.Items. AddRange(Printe rNames.ToArray)

        End Sub
        ------------------------------------

        I need to recognize: 1. the Default Printer, 2. Network printers, to
        change the appearance
        of their icons. So, I guess, I need 2 boolean functions:

        function IsDefaulPrinter (PrinterName as string) as boolean
        function IsNetworkPrinte r(PrinterName as string) as boolean
        (others assumed local, I guess)

        Do you know how to make these functions?
        Any suggestion is very welcome. Thanks,

        -Pamela

        Comment

        • Bart Mermuys

          #5
          Re: How to OPEN native PRINTER DIALOG -- Please HELP !!

          Hi,

          <pamelafluente@ libero.it> wrote in message
          news:1130805112 .344751.181390@ g49g2000cwa.goo glegroups.com.. .[color=blue]
          > Dear Burt,
          >
          > I have tried your code (on XP). Actually it is quite complete. You
          > have practically
          > done the all job. I also appreciated your correction about setting
          > the printer name.
          > You are really an angel!
          >
          > I have not tried yet to print because now its night here and I am
          > not at my office,
          > but the printer properties dialog pops up fine. In case of problems
          > I will tell you.
          >
          > If I may, I would need some further info for some refinements.
          > I am loading the printer names in a combo (or perhaps I will use a
          > treeview):
          > with something like:
          >
          > -------------------------------------
          > Private Sub YourPrinterSett ingsDialog_Load (ByVal sender...) Handles
          > MyBase.Load
          >
          > Dim PrinterNames As New ArrayList
          > For Each PrinterName As String In
          > PrinterSettings .InstalledPrint ers
          > Try
          > PrinterNames.Ad d(PrinterName)
          > Catch
          > End Try
          > Next PrinterName
          > Me.ComboBoxPrin terNames.Items. AddRange(Printe rNames.ToArray)
          >
          > End Sub
          > ------------------------------------
          >
          > I need to recognize: 1. the Default Printer, 2. Network printers, to
          > change the appearance
          > of their icons. So, I guess, I need 2 boolean functions:
          >
          > function IsDefaulPrinter (PrinterName as string) as boolean
          > function IsNetworkPrinte r(PrinterName as string) as boolean
          > (others assumed local, I guess)[/color]

          I understand you want to customize the PrintDialog, is there anything in
          particular that you want to change or add, it is possible to create your
          own, but it will involve a lot of pinvoke.

          About default and network printers, it's not that simple, if you want to do
          this for all printers then you need to think about speed. You can use the
          native function EnumPrinters(se e MSDN) but it gets complicated because a
          different level is needed for wxp/2000 or w9x/me.

          The example shows you how you can do it using 2 additional classes:
          PrinterInfo (name, isdefault, isnetwork)
          PrinterApi (thin wrapper around w32 native Printer Functions)

          YourPrintDialog .vb
          ------------------
          Public Class YourPrintDialog
          ' ....
          Private Sub LoadPrinters()
          ComboBoxPrinter Names.Clear()

          For Each pi As PrinterInfo In PrinterInfo.Ins talledPrinters
          Console.WriteLi ne("Name={0} Def={1} Network={2}", _
          pi.Name, pi.IsDefault, pi.IsNetwork)

          ComboBoxPrinter Names.Items.Add (pi.Name)
          If (pi.IsDefault) Then ComboBoxPrinter Names.Text = pi.Name
          Next
          End Sub
          ' ....
          End Class


          PrinterInfo.vb
          --------------
          Public Class PrinterInfo

          Public Name As String
          Public IsDefault As Boolean
          Public IsNetwork As Boolean

          Public Shared ReadOnly Property InstalledPrinte rs() As PrinterInfo()
          Get
          Dim infos As New ArrayList
          If (Environment.OS Version.Platfor m = PlatformID.Win3 2NT) Then
          ' window xp,2000
          Dim DefName As String = PrinterApi.GetD efPrinter()

          For Each pi4 As PrinterApi.PRIN TER_INFO_4 In _
          PrinterApi.Enum Info4( _
          PrinterApi.PRIN TER_ENUM_LOCAL Or _
          PrinterApi.PRIN TER_ENUM_CONNEC TIONS)

          Dim pi As New PrinterInfo
          pi.Name = pi4.PrinterName
          pi.IsDefault = Equals(pi4.Prin terName, DefName)
          pi.IsNetwork = (pi4.Attributes And
          PrinterApi.PRIN TER_ATTRIBUTE_N ETWORK) > 0
          infos.Add(pi)
          Next
          Else
          ' windows 95,98,me
          For Each pi5 As PrinterApi.PRIN TER_INFO_5 In _
          PrinterApi.Enum Info5(PrinterAp i.PRINTER_ENUM_ LOCAL)
          Dim pi As New PrinterInfo
          pi.Name = pi5.PrinterName
          pi.IsDefault = (pi5.Attributes And
          PrinterApi.PRIN TER_ATTRIBUTE_D EFAULT) > 0
          pi.IsNetwork = (pi5.Attributes And
          PrinterApi.PRIN TER_ATTRIBUTE_N ETWORK) > 0
          infos.Add(pi)
          Next
          End If
          Return infos.ToArray(G etType(PrinterI nfo))
          End Get
          End Property
          End Class


          PrinterApi.vb
          --------------
          Imports System.Runtime. InteropServices
          Imports System.Text

          Public Class PrinterApi

          Private Declare Auto Function EnumPrinters Lib "winspool.d rv" ( _
          ByVal flags As Int32, ByVal name As String, ByVal level As Int32, _
          ByVal pPrinterEnum As IntPtr, ByVal cbBuf As Int32, _
          ByRef pcbNeeded As Int32, ByRef pcReturned As Int32) As Int32

          Private Declare Auto Function GetDefaultPrint er Lib "winspool.d rv" ( _
          ByVal szBuffer As StringBuilder, _
          ByRef cchBuffer As Int32) As Int32

          <StructLayout(L ayoutKind.Seque ntial, CharSet:=CharSe t.Auto)> _
          Public Class PRINTER_INFO_4
          Public PrinterName As String
          Public ServerName As String
          Public Attributes As Integer
          End Class

          <StructLayout(L ayoutKind.Seque ntial, CharSet:=CharSe t.Auto)> _
          Public Class PRINTER_INFO_5
          Public PrinterName As String
          Public PortName As String
          Public Attributes As Integer
          Public DeviceNotSelect edTimeout As Integer
          Public TransmissionRet ryTimeout As Integer
          End Class

          Public Const PRINTER_ATTRIBU TE_NETWORK As Int32 = &H10
          Public Const PRINTER_ENUM_CO NNECTIONS As Int32 = &H4
          Public Const PRINTER_ENUM_LO CAL As Int32 = &H2
          Public Const PRINTER_ATTRIBU TE_DEFAULT As Int32 = &H4

          Public Shared Function GetDefPrinter() As String
          Dim sbName As New StringBuilder(3 2)
          GetDefaultPrint er( sbName, 32 )
          return sbName.ToString ()

          End Function

          Public Shared Function EnumInfo4(ByVal Flags As Int32) As PRINTER_INFO_4( )
          ' level 4 enum
          Return DirectCast( _
          EnumInfo(4, Flags, GetType(PRINTER _INFO_4)), _
          PRINTER_INFO_4( ))

          End Function

          Public Shared Function EnumInfo5(ByVal Flags As Int32) As PRINTER_INFO_5( )
          ' level 5 enum
          Return DirectCast( _
          EnumInfo(5, Flags, GetType(PRINTER _INFO_5)), _
          PRINTER_INFO_5( ))

          End Function

          Private Shared Function EnumInfo(ByVal Level As Int32, _
          ByVal Flags As Int32, ByVal InfoType As Type) As Object()

          Dim cbNeeded As Int32, cReturned As Int32
          Dim pBuffer As IntPtr, pBuf As IntPtr
          Dim pi As Object
          Dim infos As New ArrayList

          ' enumerate printers
          EnumPrinters(Fl ags, Nothing, Level, IntPtr.Zero, 0, cbNeeded, cReturned)
          pBuffer = Marshal.AllocHG lobal(cbNeeded)

          EnumPrinters(Fl ags, Nothing, Level, pBuffer, cbNeeded, cbNeeded,
          cReturned)

          pBuf = pBuffer
          For i As Int32 = 0 To cReturned - 1
          pi = Marshal.PtrToSt ructure(pBuf, InfoType)
          infos.Add(pi)

          pBuf = New IntPtr(pBuf.ToI nt64() + Marshal.SizeOf( InfoType))
          Next
          Marshal.FreeHGl obal(pBuffer)
          Return infos.ToArray(I nfoType)

          End Function
          End Class

          HTH,
          Greetings



          [color=blue]
          >
          > Do you know how to make these functions?
          > Any suggestion is very welcome. Thanks,
          >
          > -Pamela
          >[/color]


          Comment

          • pamelafluente@libero.it

            #6
            Re: How to OPEN native PRINTER DIALOG -- Please HELP !!

            Dear Burt,

            I don't now what to say.

            I should probably take a flight and come to kiss you. Or send Microsoft
            a petition to have you appointed MVP.
            Thanks!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!

            I * do have to * make my own PrintDialog. I have abolutely no choice
            because the application is such that there is no way to use the one
            provided with the language.

            So the help you are so kindly and generously providing is very crucial
            for me.

            Let me digest all the material you have provided. I will be back later
            with possible
            questions.

            A presto,

            -Pamela

            Comment

            • pamelafluente@libero.it

              #7
              Re: How to OPEN native PRINTER DIALOG -- Please HELP !!

              Dear Bart,

              I have tried it on XP Professional with a unique default local printer.

              It seems it fail to recognize the a default printer. This is the
              result:

              Name=Microsoft Office Document Image Writer Def=False Network=False

              The function:
              Public Shared Function GetDefPrinter() As String
              returns an empty string.
              GetDefaultPrint er is returning an empty stringbuilder.

              In particular

              Public Class PrinterInfo
              .....

              For Each pi4 As PrinterApi.PRIN TER_INFO_4 In
              PrinterApi.Enum Info4(PrinterAp i.PRINTER_ENUM_ LOCAL Or
              PrinterApi.PRIN TER_ENUM_CONNEC TIONS)
              Dim pi As New PrinterInfo
              pi.Name = pi4.PrinterName
              pi.IsDefault = Equals(pi4.Prin terName, DefName)

              '------------------------------------------------
              when executed on XP with a unique, default, printer I have:

              pi4.PrinterName = "Microsoft Office Document Image Writer"
              DefName = ""

              hence it does not recognize the default printer as such.
              PrinterApi.GetD efPrinter is returning empty string

              --------------------------------------------------

              pi.IsNetwork = (pi4.Attributes And
              PrinterApi.PRIN TER_ATTRIBUTE_N ETWORK) > 0
              infos.Add(pi)
              Next

              This is strange it is like the native function GetDefaultPrint er it is
              not doing its job (?)

              -Pamela

              Comment

              • Bart Mermuys

                #8
                Re: How to OPEN native PRINTER DIALOG -- Please HELP !!

                Hi,

                <pamelafluente@ libero.it> wrote in message
                news:1130868230 .681055.40850@g 47g2000cwa.goog legroups.com...[color=blue]
                > Dear Bart,
                >
                > I have tried it on XP Professional with a unique default local printer.
                >
                > It seems it fail to recognize the a default printer. This is the
                > result:
                >
                > Name=Microsoft Office Document Image Writer Def=False Network=False
                >
                > The function:
                > Public Shared Function GetDefPrinter() As String
                > returns an empty string.
                > GetDefaultPrint er is returning an empty stringbuilder.[/color]

                I think it is caused because the Name is longer then 32 characters (which is
                currently the limit inside GetDefPrinter() but also in PRINTER_INFO_4/5), if
                you can try it with a printer that has a shorter name, i will look how to
                deal with this and get back to you later.

                HTH,
                Greetings
                [color=blue]
                >
                > In particular
                >
                > Public Class PrinterInfo
                > ....
                >
                > For Each pi4 As PrinterApi.PRIN TER_INFO_4 In
                > PrinterApi.Enum Info4(PrinterAp i.PRINTER_ENUM_ LOCAL Or
                > PrinterApi.PRIN TER_ENUM_CONNEC TIONS)
                > Dim pi As New PrinterInfo
                > pi.Name = pi4.PrinterName
                > pi.IsDefault = Equals(pi4.Prin terName, DefName)
                >
                > '------------------------------------------------
                > when executed on XP with a unique, default, printer I have:
                >
                > pi4.PrinterName = "Microsoft Office Document Image Writer"
                > DefName = ""
                >
                > hence it does not recognize the default printer as such.
                > PrinterApi.GetD efPrinter is returning empty string
                >
                > --------------------------------------------------
                >
                > pi.IsNetwork = (pi4.Attributes And
                > PrinterApi.PRIN TER_ATTRIBUTE_N ETWORK) > 0
                > infos.Add(pi)
                > Next
                >
                > This is strange it is like the native function GetDefaultPrint er it is
                > not doing its job (?)
                >
                > -Pamela
                >[/color]


                Comment

                • Bart Mermuys

                  #9
                  Re: How to OPEN native PRINTER DIALOG -- Please HELP !!

                  Hi,

                  "Bart Mermuys" <bmermuys.nospa m@hotmail.com> wrote in message
                  news:eJu21ix3FH A.3880@TK2MSFTN GP12.phx.gbl...[color=blue]
                  > Hi,
                  >
                  > <pamelafluente@ libero.it> wrote in message
                  > news:1130868230 .681055.40850@g 47g2000cwa.goog legroups.com...[color=green]
                  >> Dear Bart,
                  >>
                  >> I have tried it on XP Professional with a unique default local printer.
                  >>
                  >> It seems it fail to recognize the a default printer. This is the
                  >> result:
                  >>
                  >> Name=Microsoft Office Document Image Writer Def=False Network=False
                  >>
                  >> The function:
                  >> Public Shared Function GetDefPrinter() As String
                  >> returns an empty string.
                  >> GetDefaultPrint er is returning an empty stringbuilder.[/color]
                  >
                  > I think it is caused because the Name is longer then 32 characters (which
                  > is currently the limit inside GetDefPrinter() but also in
                  > PRINTER_INFO_4/5), if you can try it with a printer that has a shorter
                  > name, i will look how to deal with this and get back to you later.[/color]

                  Oh, PRINTER_INFO4/5.PrinterName isn't limited to 32 character, so i
                  shouldn't have limited GetDefPrinter, my mistake.

                  Corrected code for GetDefPrinter inside PrinterApi:

                  Public Shared Function GetDefPrinter() As String
                  Dim len As Integer
                  Dim sbName As StringBuilder

                  GetDefaultPrint er(Nothing, len)
                  sbName = New StringBuilder(l en)

                  GetDefaultPrint er(sbName, len)
                  Return sbName.ToString ()
                  End Function

                  HTH,
                  Greetings

                  [color=blue]
                  >
                  > HTH,
                  > Greetings
                  >[color=green]
                  >>
                  >> In particular
                  >>
                  >> Public Class PrinterInfo
                  >> ....
                  >>
                  >> For Each pi4 As PrinterApi.PRIN TER_INFO_4 In
                  >> PrinterApi.Enum Info4(PrinterAp i.PRINTER_ENUM_ LOCAL Or
                  >> PrinterApi.PRIN TER_ENUM_CONNEC TIONS)
                  >> Dim pi As New PrinterInfo
                  >> pi.Name = pi4.PrinterName
                  >> pi.IsDefault = Equals(pi4.Prin terName, DefName)
                  >>
                  >> '------------------------------------------------
                  >> when executed on XP with a unique, default, printer I have:
                  >>
                  >> pi4.PrinterName = "Microsoft Office Document Image Writer"
                  >> DefName = ""
                  >>
                  >> hence it does not recognize the default printer as such.
                  >> PrinterApi.GetD efPrinter is returning empty string
                  >>
                  >> --------------------------------------------------
                  >>
                  >> pi.IsNetwork = (pi4.Attributes And
                  >> PrinterApi.PRIN TER_ATTRIBUTE_N ETWORK) > 0
                  >> infos.Add(pi)
                  >> Next
                  >>
                  >> This is strange it is like the native function GetDefaultPrint er it is
                  >> not doing its job (?)
                  >>
                  >> -Pamela
                  >>[/color]
                  >
                  >[/color]


                  Comment

                  • pamelafluente@libero.it

                    #10
                    Re: How to OPEN native PRINTER DIALOG -- Please HELP !!

                    Bart,

                    very good. Now it works. Tomorrow morning I will be able to do more
                    extensive testing on a networked environment. I will let you know the
                    result.

                    Congratulation for your knowledge. I envy you.

                    Where did you get all that know how? After one reads your code and the
                    gdi documentation everything seems even obvious, but if I should have
                    done it only reading the documentation, I would have probably struggled
                    for months to put things together. How can one become like you? :-)

                    -Pamela

                    Comment

                    • Bart Mermuys

                      #11
                      Re: How to OPEN native PRINTER DIALOG -- Please HELP !!

                      Hi,

                      <pamelafluente@ libero.it> wrote in message
                      news:1130877034 .316161.152550@ g14g2000cwa.goo glegroups.com.. .[color=blue]
                      > Bart,
                      >
                      > very good. Now it works. Tomorrow morning I will be able to do more
                      > extensive testing on a networked environment. I will let you know the
                      > result.[/color]

                      Hope it goes well.
                      [color=blue]
                      >
                      > Congratulation for your knowledge. I envy you.
                      >
                      > Where did you get all that know how? After one reads your code and the
                      > gdi documentation everything seems even obvious, but if I should have
                      > done it only reading the documentation, I would have probably struggled
                      > for months to put things together. How can one become like you? :-)[/color]

                      :-) Like all things the beginning is hard, but after a while things begin to
                      make more sense. I have done lots of pinvoke and it is a lot easier if you
                      have used api's in unmanaged code (like c/c++) before, you really need to
                      know about pointers and memory allocation. When you know enough about
                      pointers and the like then there is enough information inside .net framework
                      sdk doc to get you started with pinvoke, the rest you'll need to learn from
                      practice, examples or other sources.

                      Greetings
                      [color=blue]
                      >
                      > -Pamela
                      >[/color]


                      Comment

                      • pamelafluente@libero.it

                        #12
                        Re: How to OPEN native PRINTER DIALOG -- Please HELP !!

                        Dear Bart

                        I am going to go sleep. Just a few thoughs.
                        I am really fashinated by this kind of specific knowledge.

                        In my programs I have always tried to stick as much as possible
                        to the functionalities provided by the language, to avoid, using native
                        things,
                        that if Microsoft changes something than my program could no more work
                        or run into errors. So say mainly maintenance reason. On the other hand
                        its really exciting to put hands on that native stuff.

                        In this case I am forced to use them because strangey Microsoft does
                        not provided them in the framework. But at the same time I am afraid
                        that with maybe next version of windows my program would run into
                        errors.
                        Actually the class you made up PrinterInfo is very useful in general
                        and I don't
                        see why Microsoft does not include it (or something similar) in the
                        framework.

                        I am sure that a large number of programmers will have this basic need
                        to have control
                        on printing process, and your class is absolutely indispensable.

                        Looking at your code I have a couple of doubts. Can we rely this work
                        on any framework
                        and os (win 2003, ...)? Also about the function Equal. Is it safe to
                        use it or it would be more
                        prudent to use a case insensitive (and perhaps even trimmed) version,
                        just in case... ?

                        See you later,

                        -Pamela

                        Comment

                        Working...