コード例 #1
0
        IntPtr CreatePrinterDC(ref PAGESETUPDLGSTRUCT lppsd)
        {
            // Create managed structure for DEVNAMES
            DEVNAMES dn = new DEVNAMES();

            Marshal.PtrToStructure(lppsd.hDevNames, dn);

            // Get base address of native structure
            int iBase = (int)lppsd.hDevNames;

            // Get pointer to driver name.
            IntPtr iptrDriver = (IntPtr)(iBase + dn.wDriverOffset);
            string strDriver  = Marshal.PtrToStringUni(iptrDriver);

            // Get pointer to device name.
            IntPtr iptrDevice = (IntPtr)(iBase + dn.wDeviceOffset);
            string strDevice  = Marshal.PtrToStringUni(iptrDevice);

            // Get pointer to output port.
            IntPtr iptrOutput = (IntPtr)(iBase + dn.wOutputOffset);
            string strOutput  = Marshal.PtrToStringUni(iptrOutput);

            IntPtr hdc = CreateDC(iptrDriver, iptrDevice, iptrOutput,
                                  lppsd.hDevMode);

            return(hdc);
        }
コード例 #2
0
 void InitDlgStruct(
     ref PAGESETUPDLGSTRUCT psd,
     IntPtr hwndParent)
 {
     psd.lStructSize = Marshal.SizeOf(psd);
     psd.Flags       = 0;
     psd.hwndOwner   = hwndParent;
 }
コード例 #3
0
 void Close(ref PAGESETUPDLGSTRUCT lppsd)
 {
     if (lppsd.hDevMode != IntPtr.Zero)
     {
         NativeHeap.LocalFree(lppsd.hDevMode);
     }
     if (lppsd.hDevNames != IntPtr.Zero)
     {
         NativeHeap.LocalFree(lppsd.hDevNames);
     }
 }
コード例 #4
0
        string QueryOutputPort(ref PAGESETUPDLGSTRUCT lppsd)
        {
            // Create managed structure for DEVNAMES
            DEVNAMES dn = new DEVNAMES();

            Marshal.PtrToStructure(lppsd.hDevNames, dn);

            // Get base address of native structure
            int iBase = (int)lppsd.hDevNames;

            // Get pointer to output port.
            IntPtr iptrOutput = new IntPtr(iBase + dn.wOutputOffset);
            string strOutput  = Marshal.PtrToStringUni(iptrOutput);

            return(strOutput);
        }
コード例 #5
0
 int ShowDialog(ref PAGESETUPDLGSTRUCT psd)
 {
     return(PageSetupDlgW(ref psd));
 }
コード例 #6
0
 int PageSetupDlgW(ref PAGESETUPDLGSTRUCT lppsd);