views:

26

answers:

1

I'm copying files from the desktop to a WinCE device (via the RAPI API), and if the main WinCE program is running, I need to kill it, update and restart it again.

So far, I manage to copy the files and start the main program with no problem, but I cannot found a way to terminate a process via RAPI (there is a CeCreateProcess function but no CeTerminateProcess or similar)

Currently i'm spawning RapiProc.exe -k \MyDir\MyProcess.exe and it works, but I cannot find the way to do it via RAPI

Any ideas?

TIA

+1  A: 

RAPI doesn't provide a direct way to kill a process. You must create a custom RAPI DLL that provides that capability. As a good starting point, this blog article shows how to retrieve the device ID via a custom RAPI dll. Just modify it to broadcast a WM_CLOSE and then a TerminateProcess if that fails.

ctacke