Bug/restriction in RAPI

G

Glyn Meek

Some background...We develop an application that runs on desktop computers
that may or may not have ActiveSync installed. If it does, and the user also
has our Pocket PC version of the application, then we provide a way for
users to transfer our specific type of data file backwards and forwards
between PC and Pocket PC. Works perfectly with the RAPI code in Opennetcf so
long as the user has Activesync loaded on the PC. It doesn;t have to be
running, and we can detect that, it just has to be loaded!

RAPI requires ActiveSync to facilitate the interprocessor communication
(which makes perfect sense), but we have a lot of our users who don't have a
Pocket PC, and consequently won't require or use our interface...BUT...they
still have access to the forms in our application that initiate and handle
this file transfer. When a user enters this part of the application, the
first thing we try to do is a

Dim myRAPI as new RAPI

statement, and our users who do not have ActiveSync may still,
inadvertently, enter this part of the program. We just want to be able to
detect that ActiveSync is not running or that the 'link' is not functioning
and if they try to do anything, just tell them that (as we do with folks who
have ActiveSync installed, but perhaps not running, or where the Pocket PC
is not in the cradle). The problem is that the 'Dim' statement causes a
hard and untrappable crash in the standard RAPI .dll that we use.

Is there a way in VB to detect if ActiveSync is present and installed on the
PC, BEFORE making any RAPI calls, declarations, etc...? Is there, for
example, a particula file that is present when ActiveSync installed that we
could test for?

We have tried adding a bunch of try...catches, but in VB we don't know how
to catch the 'inescapable exception' that gets thrown up when calling RAPI
when ActiveSync is not present...

Grateful thanks in advance for any thoughts, comments or ideas...

Glyn Meek
 
G

Ginny Caughey [MVP]

Glynn,

I'm not a VB programmer so I don't know for sure, but I handle a similar
situation in an unmanaged app by attempting a LoadLibrary call on
"rapi.dll". If that fails, then I can handle the situation gracefully.
Here's an example of using LoadLibrary in VB.Net that may be helpful:
http://www.dotnetinterop.com/faq/?q=LoadLibrary
 
C

Chris Tacke, eMVP

rapi.dll I believe is in the \Windows\System32 folder of the PC. You should
be able to look in the registry as well to see if the app is installed.
 
J

Jan Yeh_eMVP

Hello, Glyn

As Ginny and Chris said, you can use LoadLibrary() and to see if it's
successful or failed to determine whether ActiveSync exists or not.
Another way is to get the find the process "wcescomm.exe" in PC,
if it exists, that means this pc has ActiveSync.
Btw, I believe that "wcescomm.exe" is the background program
to detect if Pocket PC requests to connect.

You can run your RAPI code after your program confirmed the
existence of ActiveSync.

--

Best Regards,

Jan Yeh
MVP - Windows CE.NET, MCSD.NET, .NETcf consultant
http://blog.mvpcn.net/janyeh
 

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