rmatthew Posted January 21, 2003 Posted January 21, 2003 I am trying to use the GetSystemPowerStatus API to get system power info. I know that TYPES are out in .NET (so I used a structure). However, when I make the call I get an error - supposedly due to the TYPE/STRUCTURE thing. ??????????? How do I handle the TYPE/STRUCTURE in .NET for API calls? Any help would be appreciated. Quote
*Experts* Nerseus Posted January 21, 2003 *Experts* Posted January 21, 2003 You'll have to match the parameter types as defined by the API: convert WORD to Integer, etc. Make sure you declare the API right, including the ByRef and ByVal keywords. I'm not sure of the API declaration or it's type. If you have the VB6 version, I'm sure one of us could convert it to .NET. -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
rmatthew Posted January 21, 2003 Author Posted January 21, 2003 Acutally I am probably headed the wrong way - is there a .NET class that does the equivalent of: Private Declare Function GetSystemPowerStatus Lib "kernel32" (ByVal lpSystemPowerStatus As SYSTEM_POWER_STATUS) As Long Quote
*Experts* Nerseus Posted January 21, 2003 *Experts* Posted January 21, 2003 I've never tried it, but it looks like PowerBroadcastStatus might be useful. It's part of System.ServiceProcess. Check out MSDN Library to see if it will do what you want. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts