C#自动关机源码
源码如下:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.IO;
using Microsoft.Win32;
namespace mv
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("请点击确定键关机(点确定下次开机自动关机,点取消下次不运行)", "info", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
if (result == DialogResult.Yes)
{
string path = System.Windows.Forms.Application.ExecutablePath;
int ab=path.Length;
int a = path.LastIndexOf(@"\");
int b = path.LastIndexOf(".");
string mess = path.Substring(a+1, b - a - 1);
MessageBox.Show(mess);
&nb
相关文档:
号称xmlhelper的一个类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace WebApplication2
{
/// <summary>
/// XMLHelper XML文档操作管理器
/// </summary>
public class XMLHelper
{
public X ......
(一)把文件内容写入Access数据库的OLE对象字段中:
if (File.Exists(txtBrow.Text) != false) // 文本框txtBrow中内容为文件路径及文件名
{
//获取文件后缀
FileInfo p = new FileInfo(txtBrow.Text.Trim());
F_str_Type = ......
1.如何在JavaScript访问C#函数?
问题1答案如下:
javaScript函数中执行C#代码中的函数:
方法一:1、首先建立一个按钮,在后台将调用或处理的内容写入button_click中;
2、在前台写一个js函数,内容为document.getElementById("btn1").click();
......
通过xsl转换大xml文件
这几天在做这个,网上的几个方法我都试过了,汇总如下
方法一:
XPathDocument myXPathDoc = new XPathDocument(tbXMLFile.Text);
XslCompiledTransform myXslTrans = new XslCompiledTransform();
myXslTrans.Load(tbXSLFile.Text);
XmlTextWriter myWriter = new XmlTextWrit ......
今天用到这个,网上找个不错的,保存下来。
注意:这个方法是快速关机,不会保存你的任何未保存信息。
// 这个结构体将会传递给API。使用StructLayout
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct TokPriv1Luid
{
public int Count;
public ......