Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

  • *Experts*
Posted

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

"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
Posted

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

  • *Experts*
Posted

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

"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
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...