internal static NativeMethods.PRINTDLGEX CreatePRINTDLGEX() { NativeMethods.PRINTDLGEX data = new NativeMethods.PRINTDLGEX(); data.lStructSize = Marshal.SizeOf(data); data.hwndOwner = IntPtr.Zero; data.hDevMode = IntPtr.Zero; data.hDevNames = IntPtr.Zero; data.hDC = IntPtr.Zero; data.Flags = 0; data.Flags2 = 0; data.ExclusionFlags = 0; data.nPageRanges = 0; data.nMaxPageRanges = 1; data.pageRanges = UnsafeNativeMethods.GlobalAlloc(NativeMethods.GPTR, data.nMaxPageRanges * Marshal.SizeOf <NativeMethods.PRINTPAGERANGE>()); data.nMinPage = 0; data.nMaxPage = 9999; data.nCopies = 1; data.hInstance = IntPtr.Zero; data.lpPrintTemplateName = null; data.nPropertyPages = 0; data.lphPropertyPages = IntPtr.Zero; data.nStartPage = NativeMethods.START_PAGE_GENERAL; data.dwResultAction = 0; return(data); }
internal static System.Windows.Forms.NativeMethods.PRINTDLGEX CreatePRINTDLGEX() { System.Windows.Forms.NativeMethods.PRINTDLGEX printdlgex; return(new System.Windows.Forms.NativeMethods.PRINTDLGEX { lStructSize = Marshal.SizeOf(printdlgex), hwndOwner = IntPtr.Zero, hDevMode = IntPtr.Zero, hDevNames = IntPtr.Zero, hDC = IntPtr.Zero, Flags = 0, Flags2 = 0, ExclusionFlags = 0, nPageRanges = 0, nMaxPageRanges = 1, pageRanges = UnsafeNativeMethods.GlobalAlloc(0x40, printdlgex.nMaxPageRanges * Marshal.SizeOf(typeof(System.Windows.Forms.NativeMethods.PRINTPAGERANGE))), nMinPage = 0, nMaxPage = 0x270f, nCopies = 1, hInstance = IntPtr.Zero, lpPrintTemplateName = null, nPropertyPages = 0, lphPropertyPages = IntPtr.Zero, nStartPage = System.Windows.Forms.NativeMethods.START_PAGE_GENERAL, dwResultAction = 0 }); }