I am putting the code snippet I used to get the owner name from preferences
for others who may need it.
It took some amount of research to finally get it but I would like to thank
Alvin Koh whose code got me started.

  gDB = DmOpenDatabaseByTypeCreator('sprf', 'psys', dmModeReadOnly);
    if (gDB) 
    {
        resIndex = DmFindResource(gDB, 'ownr', 1, NULL);
        resH = DmGetResource('ownr', 1);
        if (resH)
        {
            resSize = MemHandleSize(resH);
            resPtr = MemHandleLock(resH);
            buffer = (char *) MemPtrNew(resSize);
            MemMove(buffer, resPtr, resSize);
            buffer+=2;
            palmUserName = new char[20];
            MemMove(palmUserName, buffer, resSize);
            MemHandleUnlock(resH);
            DmReleaseResource(resH);
            buffer-=2;            
            MemPtrFree(buffer);
               DmCloseDatabase(gDB);
           return palmUserName;
      }
    }
}

Thanks to all..
Happy Coding



>  -----Original Message-----
> From:         Vini Bhatnagar  
> Sent: Friday, July 06, 2001 11:08 AM
> To:   '[EMAIL PROTECTED]'
> Subject:      How to retrieve owner name from Preferences?
> 
> Hi All,
> 
> I need to retrieve owner name from Palm preferences for use in my
> application. 
> To use any of the fuctions for Preferences SystemPreferencesChoice
> structure is used.
> but this does not have any reference to owner name. 
> Please Help..
> 
> Thanks
> Vini

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to