91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 41KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-17
  • 語言: C#
  • 標簽: 打印??

資源簡介

C#直接調用USB接口斑馬打印機,使打印速度更快,更方便。

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Diagnostics;
using?System.IO;
using?System.Management;

using?System.Drawing.Printing;
using?System.Collections;
using?System.Runtime.InteropServices;
using?System.Threading;?

namespace?WindowsFormsApplication2
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}

????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????//USB打印支持屬于Win32_USBHub類
????????????SelectQuery?selectQuery?=?new?SelectQuery(“Win32_USBHub“);
????????????ManagementobjectSearcher?searcher?=?new?ManagementobjectSearcher(selectQuery);
????????????foreach?(Managementobject?disk?in?searcher.Get())
????????????{
????????????????string?PNPDeviceID?=?disk[“PNPDeviceID“]?as?String;
????????????????BeginPrint(this.txtNum.Text.Trim()?PNPDeviceID);
????????????}??
????????????MessageBox.Show(“OK“);
????????}
????????public?class?Printer
????????{
????????????[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
????????????private?struct?OVERLAPPED?{?int?Internal;?int?InternalHigh;?int?Offset;?int?OffSetHigh;?int?hEvent;??????}
????????????[System.Runtime.InteropServices.DllImport(“kernel32.dll“)]
????????????private?static?extern?int?CreateFile(string?lpFileName?uint?dwDesiredAccess?int?dwShareMode?int?lpSecurityAttributes?int?dwCreationDisposition?int?dwFlagsAndAttributes?int?hTemplateFile);
????????????[System.Runtime.InteropServices.DllImport(“kernel32.dll“)]
????????????private?static?extern?bool?WriteFile(int?hFile?byte[]?lpBuffer?int?nNumberOfBytesToWrite?out???int?lpNumberOfBytesWritten?out???OVERLAPPED?lpOverlapped);
????????????[System.Runtime.InteropServices.DllImport(“kernel32.dll“)]
????????????private?static?extern?bool?CloseHandle(int?hobject);
????????????private?int?iHandle;?

????????????public?bool?Open(string?PNPDeviceID)
????????????{
????????????????//{A5DCBF10-6530-11D2-901F-00C04FB951ED}是USB設備類的classID
????????????????iHandle?=?CreateFile(“\\\\.\\“?+?PNPDeviceID.Replace(‘\\‘?‘#‘)?+?“#{A5DCBF10-6530-11D2-901F-00C04FB951ED}“
?????????????????????(uint)FileAccess.ReadWrite?0?0?(int)FileMode.Open?0?0);??
????????????????if?(iHandle?!=?-1)
????????????????{
????????????????????return?true;
????????????????}
????????????????else
????????????????{
????????????????????return?false;
????????????????}
????????????}
????????????public?bool?Write(string?Mystring)
????????????{
????????????????if?(iHandle?!=?-1)
????????????????{
????????????????????int?i;?OVERLAPPED?x;?
????????????????????byte[]?mybyte?=?System.Text.Encoding.Default.GetBytes(Mystring);
????????????????????return?WriteFile(iHandle?mybyte?mybyte.Length?out?i?out?x);
???????????????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????10752??2013-08-20?15:53??WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe

?????文件??????28160??2013-08-20?15:53??WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.pdb

?????文件??????11600??2013-08-20?15:55??WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe

?????文件????????490??2010-03-17?22:39??WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe.manifest

?????文件???????3549??2013-08-20?16:59??WindowsFormsApplication2\Form1.cs

?????文件???????2554??2013-08-20?15:53??WindowsFormsApplication2\Form1.Designer.cs

?????文件???????5817??2013-08-20?15:53??WindowsFormsApplication2\Form1.resx

?????文件???????4501??2013-08-19?09:22??WindowsFormsApplication2\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

?????文件???????6436??2013-08-20?15:53??WindowsFormsApplication2\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

?????文件????????264??2013-08-20?15:53??WindowsFormsApplication2\obj\x86\Debug\GenerateResource.read.1.tlog

?????文件????????694??2013-08-20?15:53??WindowsFormsApplication2\obj\x86\Debug\GenerateResource.write.1.tlog

?????文件????????835??2013-08-20?15:55??WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.csproj.FileListAbsolute.txt

?????文件??????10752??2013-08-20?15:53??WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.exe

?????文件????????180??2013-08-20?15:53??WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.Form1.resources

?????文件??????28160??2013-08-20?15:53??WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.pdb

?????文件????????180??2013-08-20?13:21??WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.Properties.Resources.resources

?????文件????????505??2013-08-16?10:16??WindowsFormsApplication2\Program.cs

?????文件???????1398??2013-08-16?10:16??WindowsFormsApplication2\Properties\AssemblyInfo.cs

?????文件???????2898??2013-08-16?10:16??WindowsFormsApplication2\Properties\Resources.Designer.cs

?????文件???????5612??2013-08-16?10:16??WindowsFormsApplication2\Properties\Resources.resx

?????文件???????1109??2013-08-16?10:16??WindowsFormsApplication2\Properties\Settings.Designer.cs

?????文件????????249??2013-08-16?10:16??WindowsFormsApplication2\Properties\Settings.settings

?????文件???????3754??2013-08-19?09:53??WindowsFormsApplication2\WindowsFormsApplication2.csproj

?????文件????????889??2013-08-16?10:16??WindowsFormsApplication2\WindowsFormsApplication2.sln

????I.A..H.??????8192??2016-01-04?09:46??WindowsFormsApplication2\WindowsFormsApplication2.suo

?????目錄??????????0??2013-08-16?10:16??WindowsFormsApplication2\obj\x86\Debug\TempPE

?????目錄??????????0??2013-08-20?15:53??WindowsFormsApplication2\obj\x86\Debug

?????目錄??????????0??2013-08-20?13:21??WindowsFormsApplication2\bin\Debug

?????目錄??????????0??2013-08-16?10:16??WindowsFormsApplication2\obj\x86

?????目錄??????????0??2013-08-16?10:16??WindowsFormsApplication2\bin

............此處省略6個文件信息

評論

共有 條評論