it is not work , after complie I press the button the programm is


G

Guest

Dear Sir,
which is source, but I cannot find what the problem is ?
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Threading;
using System.IO;

namespace hardreset4
{
/// <summary>
/// Form1 的摘è¦æ述。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
[DllImport("Coredll.dll")]
private extern static int KernelIoControl(int dwIoControlCode,
IntPtr lpInBuf, int nInBufSize, IntPtr lpOutBuf, int nOutBufSize , ref int
lpBytesReturned );
[DllImport("Coredll.dll")]
private extern static void SetCleanRebootFlag();
private void HardReset()
{
int IOCTL_HAL_REBOOT = 0x101003C;
int bytesReturned = 0;
SetCleanRebootFlag();
KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, ref
bytesReturned );
}

public Form1()
{
//
// Windows Form 設計工具支æ´çš„å¿…è¦é …
//
InitializeComponent();

//
// TODO: 在 InitializeComponent 呼å«ä¹‹å¾ŒåŠ å…¥ä»»ä½•å»ºæ§‹å‡½å¼ç¨‹å¼ç¢¼
//
}
/// <summary>
/// 清除任何使用中的資æºã€‚
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form 設計工具產生的程å¼ç¢¼
/// <summary>
/// 此為設計工具支æ´æ‰€å¿…須的方法 - 請勿使用程å¼ç¢¼ç·¨è¼¯å™¨ä¿®æ”¹
/// 這個方法的內容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
//
// button1
//
this.button1.Location = new System.Drawing.Point(48, 96);
this.button1.Size = new System.Drawing.Size(112, 32);
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.Controls.Add(this.button1);
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);

}
#endregion

/// <summary>
/// 應用程å¼çš„主進入點。
/// </summary>

static void Main()
{
Application.Run(new Form1());
}

private void Form1_Load(object sender, System.EventArgs e)
{

}

private void button1_Click(object sender, System.EventArgs e)
{
HardReset();
}
}
}
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top