Werner,
I don't have much to say except that there doesn't seem to be
anything obviously wrong with your code or what you're doing. Yes,
you should be able to add any amount of data to the preferences. And
if you are specifying 6 for your data length, then an 8 byte chunk
should appear in the database (6 for your data, and 2 for the version
number that is stored just before your data).
The *only* thing I could suggest is to ensure that _wPrefsSize is
also 6 before calling PrefGetAppPreferences. But that is just
clutching at straws, since you say that the problem appears to have
occurred with the call to PrefSetAppPreferences (since the exported
database doesn't appear to have your data).
-- Keith
At 1:27 AM -0700 8/9/02, Werner Poschenrieder wrote:
>PalmOS 3.3
>
>My preference _pPrefs is a pointer to a structure of type
>
>//===========================
>typedef struct
> {
> UInt32 dwRecordId;
> Char tcLandCode;
> } AppPreferenceType;
>//===========================
>
>allocated with operator new. It is stored as an app pref into saved
>prefs like this
>
>//=======================================
> PrefSetAppPreferences (_ulCid, _wPrefsId, _iVersion,
> _pPrefs, _wPrefsSize, true);
>//=======================================
>
>where _wPrefsSize = sizeof( AppPreferenceType ).
>
>Next runtime it is loaded into heap memory again:
>
>//==========================================================
> if (PrefGetAppPreferences(_ulCid, _wPrefsId, _pPrefs, &_wPrefsSize,
>true) ==
> noPreferenceFound) {
> _pPrefs->dwRecordId = 0;
> _pPrefs->tcLandCode = 0;
> }
>//==========================================================
>
>(the & is ok, a UInt16* is in accordance with the doc).
>
>I would have expected, that _pPrefs had retained it's values from
>last runtime. In fact it is nearly so: *** The first 4 Bytes only
>are retained (dwRecordId), the second member (tcLandCode) remains
>unitialized. ***
>
>I can already observe, that _wPrefsSize, which is initially 6 before
>the pref is written, is set 4 by PrefSetAppPreferences. When I
>export the database from POSE and have a look on it, I can see, that
>it ends after member dwRecordId, tcLandCode seems not to have been
>stored.
>
>I understood, that _pPrefs is a pointer to a buffer of a size, which
>is not restricted to 4 bytes, is it?
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/