11-13-2006 09:21 AM
11-13-2006 11:07 AM
Could you post a snippet of code showng the exact declaration and function call you are using?
JR
11-14-2006 02:22 AM
JR,
Below is a snipet of the code used:
LPSYSTEM_POWER_STATUS lpSystemPowerStatus = 0;
GetSystemPowerStatus (lpSystemPowerStatus);
Thanks,
James
11-14-2006 03:29 AM
11-14-2006 03:29 AM
Hi,
you've just set a long pointer to a structure to zero, so the memory address being used is 0!!
Essentially you created a pointer and pointed it to nothing rather than to a defined memory space = GPF time!
Try this instead :
#include <cvirte.h>
#include <windows.h>
#include <utility.h>
int main (int argc, char *argv[])
{
/* notes to show data layout of the system power status structure
typedef struct _SYSTEM_POWER_STATUS {
BYTE ACLineStatus;
BYTE BatteryFlag;
BYTE BatteryLifePercent;
BYTE Reserved1;
DWORD BatteryLifeTime;
DWORD BatteryFullLifeTime;
} SYSTEM_POWER_STATUS, *LPSYSTEM_POWER_STATUS;
*/
SYSTEM_POWER_STATUS SystemPowerStatus;
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
GetSystemPowerStatus (&SystemPowerStatus);
return 0;
}
Thanks
Sacha Emery
National Instruments (UK)