wpf: Open printing preferences without print dialog<div style="text-align:left">Hello, programing clever world. I gonna create custom print dialog in wpf. On my custom print dialog, pushing a button  I want to open standard printing preferences dialog where I can choose paper quality and other printer properties. How can I do it  without calling default print dialog ( <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div> <p>PrintDialog pd = new PrintDialog();   pd.ShowDialog();</p></div></div>) ? </div>© 2009 Microsoft Corporation. All rights reserved.Sat, 16 May 2009 10:58:17 Z25db3363-c985-437b-831a-7a83c7ea79b5http://social.msdn.microsoft.com/Forums/en-US/windowsxps/thread/25db3363-c985-437b-831a-7a83c7ea79b5#25db3363-c985-437b-831a-7a83c7ea79b5http://social.msdn.microsoft.com/Forums/en-US/windowsxps/thread/25db3363-c985-437b-831a-7a83c7ea79b5#25db3363-c985-437b-831a-7a83c7ea79b5Pepelhttp://social.msdn.microsoft.com/Profile/en-US/?user=Pepelwpf: Open printing preferences without print dialog<div style="text-align:left">Hello, programing clever world. I gonna create custom print dialog in wpf. On my custom print dialog, pushing a button  I want to open standard printing preferences dialog where I can choose paper quality and other printer properties. How can I do it  without calling default print dialog ( <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div> <p>PrintDialog pd = new PrintDialog();   pd.ShowDialog();</p></div></div>) ? </div>Sun, 29 Jun 2008 11:26:05 Z2008-06-29T11:26:05Zhttp://social.msdn.microsoft.com/Forums/en-US/windowsxps/thread/25db3363-c985-437b-831a-7a83c7ea79b5#eb22180d-46cb-4b59-bbc9-06d4142d07e7http://social.msdn.microsoft.com/Forums/en-US/windowsxps/thread/25db3363-c985-437b-831a-7a83c7ea79b5#eb22180d-46cb-4b59-bbc9-06d4142d07e7sarafuddinhttp://social.msdn.microsoft.com/Profile/en-US/?user=sarafuddinwpf: Open printing preferences without print dialogTry this : <br/> <br/> [DllImport(&quot;winspool.Drv&quot;, EntryPoint = &quot;DocumentPropertiesW&quot;, SetLastError = true,<br/>             ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]<br/>         static extern int DocumentProperties(IntPtr hwnd, IntPtr hPrinter,<br/>         [MarshalAs(UnmanagedType.LPWStr)] string pDeviceName,<br/>         IntPtr pDevModeOutput, ref IntPtr pDevModeInput, int fMode);<br/>         [DllImport(&quot;kernel32.dll&quot;)]<br/>         static extern IntPtr GlobalLock(IntPtr hMem);<br/>         [DllImport(&quot;kernel32.dll&quot;)]<br/>         static extern bool GlobalUnlock(IntPtr hMem);<br/>         [DllImport(&quot;kernel32.dll&quot;)]<br/>         static extern bool GlobalFree(IntPtr hMem);<br/>         private void OpenPrinterPropertiesDialog(PrinterSettings printerSettings)<br/>         {<br/>             IntPtr handle = (new System.Windows.Interop.WindowInteropHelper(this.fullScreenPrintWindow)).Handle;<br/>             IntPtr hDevMode = printerSettings.GetHdevmode(printerSettings.DefaultPageSettings);<br/>             IntPtr pDevMode = GlobalLock(hDevMode);<br/>             int sizeNeeded = DocumentProperties(handle, IntPtr.Zero, printerSettings.PrinterName, pDevMode, ref pDevMode, 0);<br/>             IntPtr devModeData = Marshal.AllocHGlobal(sizeNeeded);<br/>             DocumentProperties(handle, IntPtr.Zero, printerSettings.PrinterName, devModeData, ref pDevMode, 14);<br/>             GlobalUnlock(hDevMode);<br/>             printerSettings.SetHdevmode(devModeData);<br/>             printerSettings.DefaultPageSettings.SetHdevmode(devModeData);<br/>             GlobalFree(hDevMode);<br/>             Marshal.FreeHGlobal(devModeData);<br/>         }<br/> <pre lang="x-c#">[DllImport(&quot;winspool.Drv&quot;, EntryPoint = &quot;DocumentPropertiesW&quot;, SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] static extern int DocumentProperties(IntPtr hwnd, IntPtr hPrinter, [MarshalAs(UnmanagedType.LPWStr)] string pDeviceName, IntPtr pDevModeOutput, ref IntPtr pDevModeInput, int fMode); [DllImport(&quot;kernel32.dll&quot;)] static extern IntPtr GlobalLock(IntPtr hMem); [DllImport(&quot;kernel32.dll&quot;)] static extern bool GlobalUnlock(IntPtr hMem); [DllImport(&quot;kernel32.dll&quot;)] static extern bool GlobalFree(IntPtr hMem); private void OpenPrinterPropertiesDialog(PrinterSettings printerSettings) { //fullScreenPrintWindow in this example is a window. IntPtr handle = (new System.Windows.Interop.WindowInteropHelper(this.fullScreenPrintWindow)).Handle; IntPtr hDevMode = printerSettings.GetHdevmode(printerSettings.DefaultPageSettings); IntPtr pDevMode = GlobalLock(hDevMode); int sizeNeeded = DocumentProperties(handle, IntPtr.Zero, printerSettings.PrinterName, pDevMode, ref pDevMode, 0); IntPtr devModeData = Marshal.AllocHGlobal(sizeNeeded); DocumentProperties(handle, IntPtr.Zero, printerSettings.PrinterName, devModeData, ref pDevMode, 14); GlobalUnlock(hDevMode); printerSettings.SetHdevmode(devModeData); printerSettings.DefaultPageSettings.SetHdevmode(devModeData); GlobalFree(hDevMode); Marshal.FreeHGlobal(devModeData); } //Somewhere in you code show the dialog using this : PrinterSettings settings = new PrinterSettings(); settings.PrinterName = CurrentPrinter.FullName; OpenPrinterPropertiesDialog(settings); </pre>Sat, 16 May 2009 10:58:16 Z2009-05-16T10:58:16Z