How to detect if CF App running on PPC from the Desktop?

N

Neville Lang

Hi all,

In my Uninstaller on the desktop side, I have found that if my CF app is
running on the PPC and a user begins the process (Control Panel ->
Add/Remove programs) of removing the app from both the Desktop and Device
side then the Uninstaller just removes things only on the desktop side but
not the program on the Device if it is running.

It seems that I will need RAPI for this but I cannot work out which RAPI
function might be able to help here. The closest seems to be CeRapiInvoke
but I am not sure.

I have also read about the FindWindow() and CreateMutex() solutions for
checking whether an app is running but these solutions imply that they run
on the Device side.

Is there a simple solution to detect whether my CF app is running on the PPC
from the Desktop side?

Regards,
Neville Lang
 
N

Neville Lang

Hi all,

I have found a solution for my own question. Simply using RAPI, I use
CeDeleteFile(\Path\MyApp.exe) and if the app is running it will return a 0
otherwise if it is not running then the file will be deleted and the
function will return a 1.

In my customized Uninstaller, I can put this test first and if I detect the
CF app is running then I can inform the user and abort the rest of the
Uninstaller.

Regards,
Neville
 
N

Neville Lang

Hi all,

Further to my previous post on the technique for checking if an app is
running on the device from the desktop using RAPI, I found during coding
that to ensure that the CeDeleteFile() function is not failing because of
other errors, I needed to ensure that both the folder and the file actually
existed on the device before the CeDeleteFile() function can be run. For
this, I used RAPI's CeFindFirstFile() / CeFindClose(). The CeFindFirstFile()
can check if either a file OR directory exists on the device by the return
handle value.

The scenarios that might occur are when a "hard reset" is done on the device
or if a user mistakenly deletes either the app exe file or the app's folder.
You need to at least test for these conditions before performing the app
running test using the CeDeleteFile() idea. I concluded that if both the app
folder AND the app file exists then you reasonably assume that if the
CeDeleteFile() function return an error result then the most likely cause is
that the app is running.

Regards,
Neville Lang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top