i have ugly for user but easy to write solution

UInt16 attr;
Err err;

//you  deleted all you need and now you want to delete application itself

//get card and id of current application
SysCurAppDatabase(&cardNo,&dbID);

//set it to delete itself
err=DmDatabaseInfo(cardNo,dbID,NULL,&attr,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
attr|=dmHdrAttrRecyclable;
err=DmSetDatabaseInfo(cardNo,dbID,NULL,&attr,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

//this will cause that database will be erased when closed or on next reset
//problem is that when application simply ends it won't work, something
//overwrite this attribute (system)
//so we have to reset
SysReset();                     

this works.... but its ugly because reset happens. if someone has solution how
to make it without reset let me know please







Neil Whitworth wrote:
> Ambrose Krapacs wrote:
>> The problem is that the application consists of itself and several
>> other shared libraries. Selecting the delete app option removes only
>> the application and associated data files. I could use the
>> sysNotifyDeleteProtectedEvent notification to identify when this
>> happens but I do not want to remove all components here I would rather
>> have a menu item from within the application.
>>
>>
>> Neil Whitworth <[EMAIL PROTECTED]> wrote in
>> news:[EMAIL PROTECTED]:
>>> Ambrose Krapacs wrote:
>>>> I want to add an uninstall feature to an application, is there a way
>>>> an application delete itself? I have not been able to find a solution
>>>> to this looking through API documentation.
>>>>
>>> If the user uses the delete app option from the main applications
>>> screen, you app and all its data are deleted (everything with the same
>>> creator ID). Is this not good enough?
>>>
>>>
>>
>>
> That does make it harder... We have much the same problem, and have yet
> to address it in full.
> 
> One solution is to create a separate uninstall app that can delete the
> majority of the suite of apps/library's. This can be a relatively simple
> app (delete every database with these creator ID's) and just leave
> itself behind.
> 
> Self deleting apps can be made, but we have found them to difficult to
> implement. Our current soultion is not very nice, but seams to work.
> 
> 1) allocate a small block of memory.
> 2) assign this to the system (using MemPtrSetOwner)
> 2) copy some data from a secondary code segment to this memory
> 3) queue a procedural alarm for several seconds time, with a function
> pointer to the newly allocated memory
> 4) quit your app.
> 
> When the alarm fires, it will run the code in the newly allocated
> memory, which can the delete the just quit app.
> 
> You will leak the block of memory, but it should be just a few bytes.
> Enough to hold the code to find/delete a database.
> 
> 

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

Reply via email to