Click here to Skip to main content
15,903,523 members
Home / Discussions / C#
   

C#

 
Questionswitch off computer Pin
likefood26-Jan-09 5:39
likefood26-Jan-09 5:39 
AnswerRe: switch off computer Pin
EliottA26-Jan-09 5:55
EliottA26-Jan-09 5:55 
GeneralRe: switch off computer Pin
User 665826-Jan-09 6:00
User 665826-Jan-09 6:00 
GeneralRe: switch off computer Pin
likefood26-Jan-09 6:35
likefood26-Jan-09 6:35 
GeneralRe: switch off computer Pin
likefood26-Jan-09 6:35
likefood26-Jan-09 6:35 
AnswerRe: switch off computer Pin
Giorgi Dalakishvili26-Jan-09 6:10
mentorGiorgi Dalakishvili26-Jan-09 6:10 
GeneralRe: switch off computer Pin
likefood26-Jan-09 6:36
likefood26-Jan-09 6:36 
QuestionRe: switch off computer Pin
likefood26-Jan-09 8:16
likefood26-Jan-09 8:16 
Looking up WMI, it appears that the following should work like I want:
ManagementClass mc = new ManagementClass("CIM_PowerSupply");
object[] methodArgs = { 6, null };//with 6 being to power off
object result = mc.InvokeMethod("SetPowerState", methodArgs);

However, the program crashes with a ManagementException, saying "This method is not implemented in any class." And, Microsoft's article on the SetPowerState function says "This method is currently not implemented by WMI. To use this method, you must implement it in your own provider."

It's kind of cruel to tease me with a function that doesn't actually do anything... Anyone know how it's supposed to be "implemented"?

-Daniel
Typing too fast fro my owngood

AnswerRe: switch off computer Pin
likefood26-Jan-09 8:25
likefood26-Jan-09 8:25 
AnswerRe: switch off computer Pin
Xmen Real 26-Jan-09 14:03
professional Xmen Real 26-Jan-09 14:03 
GeneralRe: switch off computer Pin
likefood27-Jan-09 15:58
likefood27-Jan-09 15:58 
QuestionLinq to SQL question Pin
PaulPrice26-Jan-09 5:21
PaulPrice26-Jan-09 5:21 
AnswerRe: Linq to SQL question Pin
Wendelius26-Jan-09 9:00
mentorWendelius26-Jan-09 9:00 
QuestionHow to have access the drivers and API? Pin
Alex_xso26-Jan-09 5:16
Alex_xso26-Jan-09 5:16 
AnswerRe: How to have access the drivers and API? Pin
EliottA26-Jan-09 5:32
EliottA26-Jan-09 5:32 
GeneralRe: How to have access the drivers and API? Pin
WebMaster26-Jan-09 5:45
WebMaster26-Jan-09 5:45 
QuestionEmpty cell in gridview Pin
Raskelmos26-Jan-09 4:51
Raskelmos26-Jan-09 4:51 
AnswerRe: Empty cell in gridview Pin
Jim (SS)26-Jan-09 11:35
Jim (SS)26-Jan-09 11:35 
QuestionParsing Log Files Pin
alwaysthinking26-Jan-09 4:24
alwaysthinking26-Jan-09 4:24 
AnswerRe: Parsing Log Files Pin
Manas Bhardwaj26-Jan-09 4:29
professionalManas Bhardwaj26-Jan-09 4:29 
AnswerRe: Parsing Log Files Pin
Mustafa Ismail Mustafa26-Jan-09 4:41
Mustafa Ismail Mustafa26-Jan-09 4:41 
GeneralRe: Parsing Log Files Pin
alwaysthinking26-Jan-09 4:59
alwaysthinking26-Jan-09 4:59 
GeneralRe: Parsing Log Files Pin
Mark Churchill26-Jan-09 14:44
Mark Churchill26-Jan-09 14:44 
GeneralRe: Parsing Log Files Pin
Mustafa Ismail Mustafa26-Jan-09 23:49
Mustafa Ismail Mustafa26-Jan-09 23:49 
Question[Message Deleted] Pin
hkjghkj126-Jan-09 3:34
hkjghkj126-Jan-09 3:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.