设为首页  
联系我们  
加入收藏  
网页制作 冲浪宝典 图形图像 操作系统 软件教学 编程开发 认证考试 安全技术 站长专区 文学驿站 娱乐天地 游戏天地 办公软件
文章搜索
您的位置: 首页 >> 文章首页 >> 编程开发 >> 网络编程 >> C#应用 >> C#关闭Windows XP的实现代码
精品推荐
C#应用点击TOP10
·c#操作word表格
·用C#实现木马程序
·C#编写的windows计算器-源代码
·C#中连接DataTable的方法
·C#操作xml文件入门
·C#也能动态生成Word文档并填充数据
·利用C#实现标注式消息提示窗口
·使用C#在进度条中显示复制文件的进度
·C#中对注册表的操作
·像Asp一样轻松分页显示数据(C#)
网络编程点击TOP10
·『原创』C#中TreeView类操作全攻略:建立树,新增节点,删除节点,修改节点,拖动节点,与Oracle数据库交互操作(一)
·根据xsd生成xml文档
·c#操作word表格
·ASP.NET 程序中常用的三十三种代码
·ASP.NET里常用的JS
·ASP快速开发方法之数据操作
·官方水晶报表 .NET 应用程序实例下载 (C#、Visual C++.NET)
·asp学习入门经验谈
·系统托盘气泡提示和右键菜单的实现
·ASP.NET2.0下含有DropDownList的GridView编辑、删除的完整例子!
精选专题

C#关闭Windows XP的实现代码

作者: 来源:http://www.xgdown.com/ 时间:2007-10-16 12:03:30

C#关闭Windows XP的实现代码(1)

  今天来一起看看C#代码实现WINDOW XP的关闭,其实也不是很难,只要大家多动手学习一器应该能很快的写出这类代码。一起来看看代码吧:

using System;
  using System.Runtime.InteropServices;
  class shoutdown{
  [StrUCtLayout(LayoutKind.Sequential, Pack=1)]
  internal struct TokPriv1Luid
  {
  public int Count;
  public long Luid;
  public int Attr;
  }
  [DllImport("kernel32.dll", ExactSpelling=true) ]
  internal static extern IntPtr GetCurrentProcess();
  [DllImport("advapi32.dll", ExactSpelling=true, SetLastError=true) ]
  internal static extern bool OpenProcessToken( IntPtr h, int acc, ref IntPtr phtok );
  [DllImport("advapi32.dll", SetLastError=true) ]
  internal static extern bool LookupPrivilegeValue( string host, string name, ref long pluid );
  [DllImport("advapi32.dll", ExactSpelling=true, SetLastError=true) ]
  internal static extern bool AdjustTokenPrivileges( IntPtr htok, bool disall,
  ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen );
  [DllImport("user32.dll", ExactSpelling=true, SetLastError=true) ]
  internal static extern bool ExitWindowsEx( int flg, int rea );
  internal const int SE_PRIVILEGE_ENABLED = 0x00000002;
  internal const int TOKEN_QUERY = 0x00000008;
  internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;
共2页 9 7 [1] [28 :>

C#关闭Windows XP的实现代码 相关文章:
C#关闭Windows XP的实现代码 相关软件:
特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
转载请注明来源:http://www.xgdown.com