first add a class
then add these codes inside the class
VB.NET, C#, Java, HTML, JQuery, Javascript, PHP, Software Reviews, Computer Tips and Tech News
//Author : Mohamed Shimran //Blog : http://ultimateprogrammingtutorials.blogspot.com public Boolean top_ = true; public Boolean left_ = true; public int Speed =25; private void timer1_Tick(object sender, EventArgs e) { try { if (top_ == true) Form1.ActiveForm.Top += Speed; else Form1.ActiveForm.Top -= Speed; if (left_ == true) Form1.ActiveForm.Left += Speed; else Form1.ActiveForm.Left -= Speed; if (Form1.ActiveForm.Top >= Screen.PrimaryScreen.Bounds.Height - 40) top_ = false; if (Form1.ActiveForm.Left >= Screen.PrimaryScreen.Bounds.Width - 37) left_ = false; if (Form1.ActiveForm.Top < -5) top_ = true; if (Form1.ActiveForm.Left < -5) left_ = true; } catch { timer1.Enabled = false; } } private void pictureBox1_Click(object sender, EventArgs e) { timer1.Enabled = true; } private void Form1_Deactivate(object sender, EventArgs e) { timer1.Enabled = false; } private void Form1_Load(object sender, EventArgs e) { Hide(); } private void Form1_Activated(object sender, EventArgs e) { timer1.Enabled = true; }
Shell("shutdown -s")
Shell("shutdown -l")
Shell("shutdown -r")
[DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi)] protected static extern int mciSendString(string lpstrCommand, StringBuilder lpstrReturnString, int uReturnLength, IntPtr hwndCallback);after importing it add the namespace using System.Runtime.InteropServices; , then add this code to eject CD/DVD Drive
int ret = mciSendString("set cdaudio door open", null, 0, IntPtr.Zero);
int ret = mciSendString("set cdaudio door closed", null, 0, IntPtr.Zero);