USB NetPower 8800 SDK 從 C++ 轉成 C# - Part 3
因為改 C++ 成 C#,最後再加把勁把程式改完整一點, 改完後的程式會在 Windows 登出或關機時自動將 USB NetPower的插座斷電,如果在把程式加入啟動中,Windows 開機時會自動將 USB NetPower 供電,關機或登出時,自動斷電。 完整 Source Code: 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.Runtime.InteropServices; using System.Configuration; using System.IO.Ports; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public const int FILE_ATTRIBUTE_NORMAL = 0x00000080; public const uint GENERIC_READ = 0x80000000; public const uint GENERIC_WRITE = 0x40000000; public const int OPEN_EXISTING = 3; // public const UInt32 INVALID_HANDLE_VALUE = 0xffffffff; private const uint FILE_FLAG_OVERLAPPED = 0x400...