• 大小: 43KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: 其他
  • 标签: SATO  

资源简介

SATO打印机程序,测试已经通过,里面有详细的注释。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Drawing.Printing;
namespace TestPrinter
{

    public partial class FormPrintTest : Form
    {
        unsafe struct printer_defaults
        {
            public void* pdatatype; //   lptstr   
            public void* pdevmode;             //   lpdevmode   
            public uint desiredaccess;   //   access_mask   
        };

        [StructLayout(LayoutKind.Sequential CharSet = CharSet.Auto)]
        public struct PRINTER_INFO_2
        {
            public string pServerName;
            public string pPrinterName;
            public string pShareName;
            public string pPortName;
            public string pDriverName;
            public string pComment;
            public string pLocation;
            public IntPtr pDevMode;
            public string pSepFile;
            public string pPrintProcessor;
            public string pDatatype;
            public string pParameters;
            public IntPtr pSecurityDescriptor;
            public uint Attributes;
            public uint Priority;
            public uint DefaultPriority;
            public uint StartTime;
            public uint UntilTime;
            public uint Status;
            public uint cJobs;
            public uint AveragePPM;
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct JOB_INFO_1
        {
            long JobId;
            string pPrinterName;
            string pMachineName;
            string pUserName;
            string pDocument;
            string pDatatype;
            string pStatus;
            int Status;
            int Priority;
            int Position;
            int TotalPages;
            int PagesPrinted;
            DateTime Submitted;
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct DOCINFO
        {
            [MarshalAs(UnmanagedType.LPWStr)]
            public string pDocName;
            [MarshalAs(UnmanagedType.LPWStr)]
            public string pOutputFile;
            [MarshalAs(UnmanagedType.LPWStr)]
            public string pDataType;
        }

        [DllImport(“winspool.drv“ CharSet = CharSet.Unicode ExactSpelling = false CallingConvention = CallingConvention.StdCall)]
        public static extern int StartDocPrinter(IntPtr hPrinter int Level ref DOCINFO pDocInfo);

        [DllImport(“winspool.drv“ CharSet = CharSet.Unicode ExactSpelling = false CallingConvention = CallingConvention.StdCall)]
        public static extern long StartPagePrinter(IntPtr hPrinter);

        [DllImport(“kernel32“ SetLastError = true)]
        static extern int GetLastError();

        [DllImportAttribute(“winspool.drv“ SetLastError = true)]
        static extern unsafe bool

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2008-02-25 09:28  TestPrinter\
     目录           0  2012-09-29 10:48  TestPrinter\TestPrinter\
     文件        4680  2012-09-05 09:59  TestPrinter\TestPrinter\FormPrintTest.Designer.cs
     文件        9859  2012-09-29 10:48  TestPrinter\TestPrinter\FormPrintTest.cs
     文件        5814  2012-09-05 09:59  TestPrinter\TestPrinter\FormPrintTest.resx
     文件         478  2012-08-28 14:01  TestPrinter\TestPrinter\Program.cs
     目录           0  2008-02-25 09:28  TestPrinter\TestPrinter\Properties\
     文件        1194  2008-02-19 09:15  TestPrinter\TestPrinter\Properties\AssemblyInfo.cs
     文件        2877  2008-02-19 09:15  TestPrinter\TestPrinter\Properties\Resources.Designer.cs
     文件        5612  2008-02-19 09:15  TestPrinter\TestPrinter\Properties\Resources.resx
     文件        1095  2008-02-19 09:15  TestPrinter\TestPrinter\Properties\Settings.Designer.cs
     文件         249  2008-02-19 09:15  TestPrinter\TestPrinter\Properties\Settings.settings
     文件        3318  2012-08-31 15:35  TestPrinter\TestPrinter\TestPrinter.csproj
     目录           0  2012-08-31 15:24  TestPrinter\TestPrinter\bin\
     目录           0  2012-09-29 10:48  TestPrinter\TestPrinter\bin\Debug\
     文件       24576  2012-09-29 10:48  TestPrinter\TestPrinter\bin\Debug\TestPrinter.exe
     文件       24064  2012-09-29 10:48  TestPrinter\TestPrinter\bin\Debug\TestPrinter.pdb
     文件        5632  2005-12-08 14:51  TestPrinter\TestPrinter\bin\Debug\TestPrinter.vshost.exe
     目录           0  2012-08-29 13:18  TestPrinter\TestPrinter\obj\
     目录           0  2012-09-29 10:48  TestPrinter\TestPrinter\obj\Debug\
     目录           0  2012-09-29 10:49  TestPrinter\TestPrinter\obj\Debug\Refactor\
     目录           0  2012-09-29 10:49  TestPrinter\TestPrinter\obj\Debug\TempPE\
     文件         180  2012-09-29 10:48  TestPrinter\TestPrinter\obj\Debug\TestPrinter.FormPrintTest.resources
     文件         180  2012-09-29 10:48  TestPrinter\TestPrinter\obj\Debug\TestPrinter.Properties.Resources.resources
     文件         850  2012-09-29 10:48  TestPrinter\TestPrinter\obj\Debug\TestPrinter.csproj.GenerateResource.Cache
     文件       24576  2012-09-29 10:48  TestPrinter\TestPrinter\obj\Debug\TestPrinter.exe
     文件       24064  2012-09-29 10:48  TestPrinter\TestPrinter\obj\Debug\TestPrinter.pdb
     文件         296  2008-02-25 09:25  TestPrinter\TestPrinter\obj\TestPrinter.csproj.FileList.txt
     文件        1912  2012-09-29 10:48  TestPrinter\TestPrinter\obj\TestPrinter.csproj.FileListAbsolute.txt
     文件         922  2008-02-19 09:15  TestPrinter\TestPrinter.sln
     文件       34304  2012-09-29 10:48  TestPrinter\TestPrinter.suo
............此处省略0个文件信息

评论

共有 条评论