> From: Iehab AL Rassan
>
> I have searched in the header files to see how this function defined. I
> found datat type called "BytePtr" and the prototype defined is as
> follows :
>
> UInt SysBatteryInfo(Boolean set, UIntPtr warnThresholdP, UIntPtr
> criticalThresholdP,
> UIntPtr maxTicksP, SysBatteryKind* kindP, Boolean*
> pluggedIn, BytePtr
> percentP)
> SYS_TRAP(sysTrapSysBatteryInfo);
>
> I have tried to use BytePtr or even Byte with an "*" to the percentage
> variable I am using; It does not give me any compilation error. But when
> loads the program in the emulator and calls the function from the program,
> the program halts. All other functions in the program works fine
> except this one.
So you are definitely using the 3.1 SDK as Ben thought. (I thought you were
saying that the only error you got was not recognizing UInt8, so I didn't
realize that you were using 3.1.)
I believe that you should be able to call it like this:
UInt result;
Byte percent;
result = SysBatteryInfo (false, NULL, NULL, NULL, NULL, NULL, &percent);
Under the 3.5 SDK, you definitely can call it this way:
UInt16 result;
UInt8 percent;
result = SysBatteryInfo (false, NULL, NULL, NULL, NULL, NULL, &percent);
The only difference between the two sets of code is that the 3.5 version
uses the new data types (which are not defined in the 3.1 SDK).
Is your code the same as mine?
Exactly how does the program halt? Do you get any error messages?
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/