Shimon Shnitzer wrote:
> Hi,
>
> Can you post the code and/or the prc ?
>
following function is one i am using. works well eith treo650 and
treo700p...does nothing on treo680 :-(
//ptr points to block with jpg image
//ptrsize is size of jpg image
void SetPhoneBackgroung(void *ptr, UInt32 ptr_size)
{
UInt32 creator;
DmSearchStateType sstate;
UInt16 card;
LocalID id;
Err err;
PhoneAppLaunchCmdSetWallpaperType *phonebg;
FileHand fh;
UInt32 result;
//we must find phone application
creator=hsFileCPhone2;
err=DmGetNextDatabaseByTypeCreator(true,&sstate,'appl',hsFileCPhone2,true,&card,&id);
if(err==dmErrCantFind)
{
//v2 version not found so lets look for v1
creator=hsFileCPhone;
err=DmGetNextDatabaseByTypeCreator(true,&sstate,'appl',hsFileCPhone,true,&card,&id);
}
if(!err)
{
//we will launch application with special launch code
//so we must prepare data for this launchcode
phonebg=MemPtrNew(sizeof(PhoneAppLaunchCmdSetWallpaperType));
if(phonebg)
{
//we must save picture to temporary file, which must
remain valid!
//phone will remember input, but it will set background
only on next manual
launch!
fh=FileOpen(0,"JPG_TEMPFILE",creator,creator,fileModeReadWrite,&err);
if(fh && (!err))
{
FileWrite(fh,ptr,ptrsize,1,&err);
FileClose(fh);
if(!err)
{
//file is saved succesfully so we just
send notice to phone
MemSet(phonebg,sizeof(PhoneAppLaunchCmdSetWallpaperType),0);
phonebg->wallpaperLocation.fileLocationType=palmPhotoStreamLocation;
StrCopy(phonebg->wallpaperLocation.file.StreamFile.name,"JPG_TEMPFILE");
phonebg->wallpaperLocation.file.StreamFile.type=creator;
phonebg->wallpaperLocation.file.StreamFile.creator=creator;
//everything is ready, so actually its time to
call phone and finish it
err=SysAppLaunch(card,id,0,phoneAppLaunchCmdSetWallpaper,phonebg,&result);
//if err!=0 then there was error
launching application
//if result!=0 then launched
application returned error
}
}
}
}
}
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/