Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating a service

16 views
Skip to first unread message

hammerstein

unread,
Jul 12, 2006, 9:58:18 AM7/12/06
to
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?

<ctacke/>

unread,
Jul 12, 2006, 10:08:35 AM7/12/06
to
You can't create a service in managed code, but you don't really need one
for this. Have your app P/Invoke CeRunAppAtEvent.

The SDF could simplify this:

http://www.opennetcf.org/library/OpenNETCF.WindowsCE.DeviceManagement.ACPowerApplied.html

-Chris


"hammerstein" <terrybu...@hypersonicscream.com> wrote in message
news:1152712698....@m79g2000cwm.googlegroups.com...

hammerstein

unread,
Jul 12, 2006, 10:27:31 AM7/12/06
to
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?

<ctacke/>

unread,
Jul 12, 2006, 10:46:17 AM7/12/06
to
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

"hammerstein" <terrybu...@hypersonicscream.com> wrote in message

news:1152714451.9...@i42g2000cwa.googlegroups.com...

hammerstein

unread,
Jul 12, 2006, 11:05:43 AM7/12/06
to
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!

Robert Holmes

unread,
Jul 12, 2006, 1:41:03 PM7/12/06
to
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

"<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote in message
news:uVYU9Hcp...@TK2MSFTNGP04.phx.gbl...

Paul G. Tobey [eMVP]

unread,
Jul 12, 2006, 2:32:17 PM7/12/06
to
Yes, you can. You want to read up on ActiveSync registry entries and the
Remote API (RAPI).

Paul T.

"Robert Holmes" <Rob...@community.nospam> wrote in message
news:eZldopdp...@TK2MSFTNGP05.phx.gbl...

Simon Hart

unread,
Jul 12, 2006, 4:08:20 PM7/12/06
to
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.

"Robert Holmes" <Rob...@community.nospam> wrote in message
news:eZldopdp...@TK2MSFTNGP05.phx.gbl...

Robert Holmes

unread,
Jul 12, 2006, 6:36:38 PM7/12/06
to
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?

"Simon Hart" <srha...@yahoo.com> wrote in message
news:uxact7ep...@TK2MSFTNGP05.phx.gbl...

Simon Hart

unread,
Jul 13, 2006, 10:43:30 AM7/13/06
to
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.

"Robert Holmes" <Rob...@community.nospam> wrote in message

news:Oqiu1Ogp...@TK2MSFTNGP03.phx.gbl...

Robert Holmes

unread,
Jul 13, 2006, 11:00:50 AM7/13/06
to
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

"Simon Hart" <srha...@yahoo.com> wrote in message

news:udIX4qo...@TK2MSFTNGP05.phx.gbl...

0 new messages