易截截图软件、单文件、免安装、纯绿色、仅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生成静态页面

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 网页添加标题、关键字、描述本文

在网页的开发中为了搜索引擎的优化,添加页面的title
keyword description是最常用的方法之一。
asp.net的方法代码如下所示:
 
 
 
 
 
public void SEO_HEAD(string title, string keyword, string
description)
 
 
 
 
 
 
 
{
  ......

Fckeditor配置攻略 asp.net版

网络文本编辑器----Fckeditor之使用篇
1.下载Fckeditor,asp.net版分两部分,FCKeditor和FCKeditor.Net: ASP.Net Control。
官方网站:http://ckeditor.com/download
2.Fckeditor在项目中的集成。
  很简单,不再赘述。
参考文献:http://www.cnblogs.com/zhubo/archive/2008/10/21/using_fckeditor_net.html
常 ......

asp.net关于@Register使用

@ Register创建标记前缀和自定义控件之间的关联,这为开发人员提供了一种在 ASP.NET 应用程序文件(包括网页、用户控件和母版页)中引用自定义控件的简明方法。
<%@ Register tagprefix="tagprefix"
   namespace="namespace"
   assembly="assembly" %>
<%@ Register tagprefix="tagpref ......

ASP.NET自动生成页面后台代码

 声明:
只提供后台.cs文件代码
详细教程地址:http://download.csdn.net/source/2289546
1.需要 编写静态模板页 我使用的是 template.htm
2.在模板页中定义htmlyem标记,标记非固定内容,在后台代码中为标记赋值
3.后台代码如下:
using System;
using System.Data;
using System.Configuration;
using Syst ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号