随笔分类 - C#
摘要:public static List<string> GetMacByWMI() { List<string> macs =new List<string>(); try { string mac =""; ManagementClass mc =new ManagementClass("Win32
阅读全文
摘要:在c#中退出WinForm程序包括有很多方法,如:this.Close(); Application.Exit();Application.ExitThread(); System.Environment.Exit(0); 等他们各自的方法不一样,下面我们就来详细介绍一下。 1.this.Close
阅读全文
摘要: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; namespace 计时器 ...
阅读全文
摘要://检测硬件改变 protected override void WndProc(ref Message m) { const int WM_DEVICECHANGE = 0x219; if (m.Msg == WM_DEVICECHANGE) { if...
阅读全文
摘要:1.在Form1类中添加以下代码 private delegate void UpdateStatusDelegate(string status); private void UpdateStatus(string status) { this.t...
阅读全文
摘要:1. 项目右键--属性---生成--允许不安全代码2.在代码中加入unsafe关键字[DllImport("DLL.dll")] unsafe public static extern bool UsbWrite(char* WriteBuffer, int size); ...
阅读全文
摘要:1.将DLL复制到工程下 2.添加如下代码
阅读全文
摘要:using System;using System.Drawing;using System.Windows.Forms;using System.Runtime.InteropServices;namespace test{ public partial class Form1 : Form...
阅读全文