API Call

rmatthew

Well-known member
Joined
Dec 30, 2002
Messages
115
Location
Texas
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.
 
Youll 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.

Im not sure of the API declaration or its type. If you have the VB6 version, Im sure one of us could convert it to .NET.

-ner
 
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
 
Ive never tried it, but it looks like PowerBroadcastStatus might be useful. Its part of System.ServiceProcess. Check out MSDN Library to see if it will do what you want.

-Nerseus
 
Back
Top