问题如下:1.  调用打印机属性:  我现在使用API 调出打印机属性,只调出属性的"设备设置"选项,
而我需要调出所有"属性"里的选项..如"常规","共享","高级"等选项卡
...2.  在调出"设备设置"选项后,里面可编辑的部分全部是灰色,不允许我修改!请问,如何让里面的部分可以修改...以下为相关代码:
 private PrintDocument _document = null;
        public Form1()
        {
            InitializeComponent();            Initialize();
        }        private void Initialize()
        {
            _document = new PrintDocument();
            _document.PrintPage += new PrintPageEventHandler(Document_PrintPage);
        }
        public PrintDocument Document
        {
            get { return _document; }
        }
        private void printPropButton_Click(object sender, EventArgs e)
        {
            string printerName = _document.PrinterSettings.PrinterName;            if (printerName != null && printerName.Length > 0)
            {
                IntPtr pPrinter = IntPtr.Zero;
                IntPtr pDevModeOutput = IntPtr.Zero;
                IntPtr pDevModeInput = IntPtr.Zero;
                IntPtr nullPointer = IntPtr.Zero;                OpenPrinter(printerName, ref pPrinter, ref nullPointer);                int iNeeded = PrinterProperties(this.Handle, pPrinter);
                ClosePrinter(pPrinter);
            }
        } [System.Runtime.InteropServices.DllImportAttribute("winspool.drv", SetLastError = true)]
        public extern static int DocumentProperties(
            IntPtr hWnd,              // handle to parent window 
            IntPtr hPrinter,           // handle to printer object
            string pDeviceName,   // device name
            ref IntPtr pDevModeOutput, // modified device mode
            ref IntPtr pDevModeInput,   // original device mode
            int fMode);                 // mode options        [System.Runtime.InteropServices.DllImportAttribute("winspool.drv",BestFitMapping = true)]
        public static extern int PrinterProperties(
            IntPtr hwnd,  // handle to parent window 
            IntPtr hPrinter); // handle to printer object        [System.Runtime.InteropServices.DllImportAttribute("winspool.drv", SetLastError = true)]
        public extern static int OpenPrinter(
            string pPrinterName,   // printer name
            ref IntPtr hPrinter,      // handle to printer object
            ref IntPtr pDefault);    // handle to default printer object.        [System.Runtime.InteropServices.DllImportAttribute("winspool.drv", SetLastError = true)]
        public static extern int ClosePrinter(
            IntPtr phPrinter); // handle to printer object        const int DM_PROMPT = 4;请教高手...

解决方案 »

  1.   

    http://topic.csdn.net/u/20090513/10/e1c2e91b-3711-4587-83e8-819ff3aeacb5.html
    楼主看可以参照吗?
      

  2.   

    用API调出打印机属性的话,将某些选项卡可能会丢失。 
    这个,在微软的页面上有解释。
    可能需要用其他方法来实现。http://support.microsoft.com/kb/198860/zh-cn
      

  3.   

    jf是否aspnet帐户权限的问题?
      

  4.   

    http://jone33.download.csdn.net/   资源不错,文档很多。
      

  5.   

    能够使用API启动本地或者远程的视频么?
      

  6.   

    主要是写进API的参数合理不合理,类型字段多不多少不少,多跟几个断点和正确的比较,应该能搞定
      

  7.   


    调用API弹出打印机属性对话框
    调用api弹出打印机属性对话框 
    Author:vitoriatang
    From:Internet
    .NET Framework封装了很多关于打印的对话框,比如说PrintDialog, PageSetupDialog. 
    但是有的时候我们还需要关心打印机属性对话框,那么就可以调用API来解决这个问题。有几个API函数与之相关
    PrinterProperties
    DocumentProperties
    OpenPrinter
    ClosePrinter
    逐一介绍printerproperties
    显示打印机属性对话框。documentproperties
    显示打印机配置对话框。openprinter
    打开打印机closeprinter
    关闭打印机在调用printerproperties或者documentproperties的时候,都需要先调用openprinter,并在结束后调用closeprinter。至于打印机属性和打印机配置有什么不同,就自己领会了。更为详尽的信息可以查阅msdnsample codes:
    1. 声明API函数
           [System.Runtime.InteropServices.DllImportAttribute("winspool.drv", SetLastError = true)]
           public extern static int DocumentProperties(
                IntPtr hWnd,              // handle to parent window 
                IntPtr hPrinter,           // handle to printer object
                string pDeviceName,   // device name
                ref IntPtr pDevModeOutput, // modified device mode
                ref IntPtr pDevModeInput,   // original device mode
                int fMode);                 // mode options         [System.Runtime.InteropServices.DllImportAttribute("winspool.drv")]
            public static extern int PrinterProperties(
                IntPtr hwnd,  // handle to parent window
                IntPtr hPrinter); // handle to printer object         [System.Runtime.InteropServices.DllImportAttribute("winspool.drv", SetLastError = true)]
            public extern static int OpenPrinter(
                string pPrinterName,   // printer name
                ref IntPtr hPrinter,      // handle to printer object
                ref IntPtr pDefault);    // handle to default printer object.         [System.Runtime.InteropServices.DllImportAttribute("winspool.drv", SetLastError = true)]
            public static extern int ClosePrinter(
                IntPtr phPrinter); // handle to printer object
    2.调用DocumentProperties
    private void documentPropButton_Click(object sender, EventArgs e)
            {
                string printerName = _document.PrinterSettings.PrinterName;             if (printerName != null && printerName.Length > 0)
                {
                    IntPtr pPrinter = IntPtr.Zero;
                    IntPtr pDevModeOutput = IntPtr.Zero;
                    IntPtr pDevModeInput = IntPtr.Zero;
                    IntPtr nullPointer = IntPtr.Zero;                 OpenPrinter(printerName, ref pPrinter, ref nullPointer);                 int iNeeded = DocumentProperties(this.Handle, pPrinter, printerName, ref pDevModeOutput, ref pDevModeInput, 0);
                    pDevModeOutput = System.Runtime.InteropServices.Marshal.AllocHGlobal(iNeeded);
                    DocumentProperties(this.Handle, pPrinter, printerName, ref pDevModeOutput, ref pDevModeInput, DM_PROMPT);
                    ClosePrinter(pPrinter);
                }
            } 3. 调用PrinterProperties
    private void printPropButton_Click(object sender, EventArgs e)
            {
                string printerName = _document.PrinterSettings.PrinterName;             if (printerName != null && printerName.Length > 0)
                {
                    IntPtr pPrinter = IntPtr.Zero;
                    IntPtr pDevModeOutput = IntPtr.Zero;
                    IntPtr pDevModeInput = IntPtr.Zero;
                    IntPtr nullPointer = IntPtr.Zero;                 OpenPrinter(printerName, ref pPrinter, ref nullPointer);                 int iNeeded = PrinterProperties(this.Handle, pPrinter);
                    ClosePrinter(pPrinter);
                }
      

  8.   

    这个值得研究,http://support.microsoft.com/kb/198860/zh-cn这里说了“请注意某些选项卡可能缺少手动显示这些属性时看到的内容。”