C# Help

dennis721

Baseband Member
Messages
49
I'm trying to make a small application with a GUI interface (rather than a batch file) so that i can shutdown computers in my classroom when i need to get my students attention. I know the command prompt commands, is there a way to link them to buttons in a C# program?
 
Do you want to shut it down from your computer? I know how to implement the command for shutdown in C++. I just don't know how to make it so you can run the program on your computer to shut it down on another. Not much of a help I guess. I think there are programs out there that let you turn the screen black an they can't use their mouse or anything. At the library at my school that's what they have. A black screen that says "Don't play games during school day". They can disable and enable it whenever. I could try to get it for you if you want.
 
I want to assign shutdown commands to buttons, so that i can click the button rather than type the command. It is always going to be the same computers
 
Oh ok. I think I understand. You want it to be placed on each computer rather than on yours. I know how you can make a file (.exe), and then make it permanent (alt+0255). The code is super easy.

for C++:
system("shutdown -s -t [time] -c '[caption]'");
to cancel:
shutdown -a on run
 
Give this a try, just off the top of my head, might need some work because I don't remember everything exactly for the cmd line part.

Code:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
string compName = "RemoteComp";
string strCmdLine = "/C shutdown -s -t:0 -m \\" + compName;
proc.EnableRaisingEvents = false;
System.Diagnostics.Process.Start("CMD.exe",strCmdLine);
proc.Close();
 
Back
Top Bottom