日期:2014-05-17  浏览次数:21216 次

API函数GetDevicePowerState用C#如何调用或是用方法
根据客户要求要做一个关于电源策略的设置。所以想请教各位大神API函数GetDevicePowerState用C#如何调用,最好是能告诉我具体方法有个实例参考。求指教.........
C#?API? API GetDevicePowerState

------解决方案--------------------
API函数不需要引用,是用DllImport导入的声明的
[DllImport("Kernel32.DLL", CharSet = CharSet.Auto,
     SetLastError = true)]
  private extern static
    bool GetSystemPowerStatus(
        SYSTEM_POWER_STATUS SystemPowerStatus);


给你一个参考网址吧MSDN上的,有代码
http://msdn.microsoft.com/en-us/library/ms704147(VS.85).aspx