Skip to content
⌘ NSIS Forum Archive

How to delete a file from pocket PC in the process of install

8 posts

maveraa#

How to delete a file from pocket PC in the process of install

Hi ;

I have a script which sent some cab files to pocket pc and install them.

I want my script to do that: When installing is finished, control the install directory on pocket pc (ex: program files\Demo) and delete a file specified(ex: demo.sdf).

How can I do that?

Thanks..
maveraa#
...

Thanks for your quick response.

I have no idea about code you wrote. Can you give me a link, refference or a key words about it?
Highcoder#
...

Have a look at the NSIS website. In the developer center there are PDA examples where you can read more about it.

Cheers
maveraa#
Only example I can found is this: http://nsis.sourceforge.net/Copying_files_to_pda

However, I couldn't solve my problem with this link.

Is there any example directly about CeDeleteFile?
Highcoder#
...

Can´t test it in the moment but it should be:

System::Call "rapi::CeRapiInit()" ;initialize RAPI connection
System::Call "rapi::CeDeleteFile(w '\somefile.ext')" ;delete "somfile.ext"
System::Call "rapi::CeRapiUninit()" ;UNinitialize RAPI connection
System::Free 0 ;free up mem. 
cheers
Highcoder#
...

Fine. 🙂
But keep in mind that there is no errorhandling in this code...

The better code is:

StrCpy $0 "" ;set $0 to "nothing"
System::Call "rapi::CeRapiInit() i .r0" ;initialize RAPI and put returncode to $0. 0=success
StrCmp $0 "0" +3 0 ; if errors display Message & abort, else delete file.
MessageBox MB_OK "error initializing rapi interface. make sure the device is connected"
abort
System::Call "rapi::CeDeleteFile(w '\somefile.ext')" ;delete "somfile.ext" 
System::Call "rapi::CeRapiUninit()" ;UNinitialize RAPI connection 
System::Free 0 ;free up mem. 
have fun