Creating a service

  • Thread starter Thread starter hammerstein
  • Start date Start date
H

hammerstein

I'm using C#(in VS2005)and a PocketPC2003 based Dolphin Handheld.

I'm wanting to write a service that will, when the power status changes
to AC power proceed to run a program that will make a connection to a
server and begin transferring data from the device.

I can find no way of doing this, any ideas?
 
Thanks for the guidance. Just another question,

My main application is a client of a server on a local PC, I want that
to be able to be started by the user. However, I want an application
to run when they dock the device (not using Activesync at all as there
will be four devices connecting). The application will make a socket
connection to my server, and then begin transferring data, locking out
the main application. I don't want to make the monitoring application
accessible or visible to the user, nor do I want them to have to start
anything.

How would I run the application to monitor the status of the AC Power,
I can't quite understand that part. Is it possible?
 
It's going to have to get run once in some manner, whether that's by user
action, autorun froma card, run from a setup, placed in the \windows\startup
folder or whatever. Once run, the app can handle notifications from that
point on.

A sevice wouldn't be much different, as it has to get registered and started
somehow.
-Chris
 
I think I understand it all a little better now, thanks for the
assistance.

We're using a Dolphin 9500, and within their SDK there are functions
for monitoring the power status. I think I'm going to put the stuff in
my main application, unless I can figure out how to hide the process in
the background.

It's a steep learning curve, thanks for your help!
 
As an alternative to that would it be possible to have an application, or
service, on the host respond to a connection event. In other words could I
install something on the host computer, that will take some action when a
device gets cradled?

thanks in advance
 
Yes, you can. You want to read up on ActiveSync registry entries and the
Remote API (RAPI).

Paul T.
 
In addition to using RAPI, if you want to drive this from the device using
WM5 you can use the Microsoft.WindowsMobile.Status namespace. In particular
the SystemState class to trap core Windows CE events. WM5 makes this easy in
managed code.

Regards
Simon.
 
Thanks for the reply Simon. I have heard that it is easy to do this in WM5
and managed code, but so far have failed to make it work. The
WindowsMobile.Status namespace can tell me when I am connected, but I have
not seen how I can access the host machine's file system, particularly
public shares. I tried the library from the OpenNETCF, and a couple of
people from there, Alex and Chris, have been very helpful about it, but it
does not work so far for me. I have tried multiple variations on
Network.MapDrive (always get number 53, PAT_NOT_FOUND errors, and
GetConnectedResources (I always get 'System.ArgumentException: The parameter
is incorrect.').

My strong preference is to handle it form the device side, but it seems that
I have no choice but but to handle it from the host side. Any ideas?
 
Can you access the desktop share from within File Explorer on the device?
ie: \\192.3.0.45\myshared Folder. Note: Use the IP address instead of
NETBios name to avoid DNS issues.
I must admit I usually use Web Services for this kind of thing. But what you
are trying to do is fairly basic so should work.

Regards
Simon.
 
Simon,

No, I am not able to map the drive manually from File Explorer on the
device. I went into Open Path -> New Path from the menu, then input
\\ipaddress\sharename, but when I try to access I get message boxes that say
'The network path was not found', then 'Network resource was not found or
you do not have permission to access the network', the same as when I map
from code then try to access the mapped drive. I went to a colleague's
machine and he could map the drive from his machine just fine, then explore
it.

I apologize for my ignorance, but this is my first foray into Pocket PC
programming. I do not know what to do on the device, or my local machine, to
allow the mapping to occur.

Thanks in advance for your help.

- Robert
rholmes[@]mywebgrocer.com
 
Back
Top