易截截图软件、单文件、免安装、纯绿色、仅160KB

asp.net 利用WMI实现关机重启

我这是拿来别人用的,为了方便以后自己看吧,看对大家有帮忙吗
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace AppBLL
{
public class ShutDown
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct ToKprivlLuid
{
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 ToKprivlLuid newst, int len, IntPtr prev, IntPtr relen);
[DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
internal static extern bool ExitWindowsEx(int flg, int rea);
//C#关机代码
// 以下定义了在调用WinAPI时需要的常数。
//这些常数通常可以从Platform SDK的包含文件(头文件)中找到
internal const int SE_PRIVILEGE_ENABLED = 0x00000002;
internal const int TOKEN_QUERY = 0x00000008;
internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;
internal const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege";
internal const int EWX_LOGOFF = 0x00000000;
internal const int EWX_SHUTDOWN = 0x00000001;
internal const int EWX_REBOOT = 0x00000002;
internal const int EWX_FORCE = 0x00000004;
internal const int EWX_POWEROFF


相关文档:

ASP.NET中防止页面多次提交的代码实现

此处提供的代码用来实现当asp.net页面中的某个Button被点击后disable掉该页面中所有的Button,从而防止提交延时导致的多次提交。基于之前的onceclickbutton脚本.
//ASP.NET中防止页面多次提交的代码:javascript< script language=”javascript”> < !– function disableOtherSubmit() {
var obj ......

asp.net生成静态页面

public static void GetHtml(string url,string savepath)//url参数为将要生成的那个动态页面的地址,savepath为要存放地址
{
string Result;
WebResponse MyResponse;
WebRequest MyRequest = System.Net.HttpWebRequest.Create(url);
MyResponse = MyReque ......

asp.net中容易混淆的ajax概念


AJAX是Asynchronous JavaScript and XML缩写。这个概念代表的是一种技术,当您在说“我在项目中使用了AJAX技术时”,只是代表了您使用客户端XMLHttpRequest对象与服务器端进行异步通信。不过因为随着AJAX技术的运用往往会带来丰富的客户端效果,因此对AJAX技术的广义理解也可以认为这是一种操作 ......

asp.net控件开发(三):处理标签间内容

asp.net教程:asp.net控件开发(三):处理标签间内容
asp.net控件标签间的内容有的时候处理成节点有的时候处理成子控件。如:间的节点就会处理成属性Text的值,而如Panel这样的控件则就是将其处理成子控件。首先看如何处理成属性的。
  一、处理成为属性
  对于控件标签间的内容我们可以通过类System.Web.UI.ParseChil ......

asp.net连接access数据库进行添加更新删除查询操作

连接access数据库代码,写在一个单独的类里
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
namespace AppWebDLL
{
    public class ConnApp
    {
       ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号