PC Review


Reply
Thread Tools Rate Thread

How to communicate with Windows Service in C#?

 
 
=?Utf-8?B?Q2hhcmxlcyBDaGlhbmc=?=
Guest
Posts: n/a
 
      15th Nov 2004
Hi,

I created a CE Windows Service in C++ and a client test harness. Now I am
trying to create 2nd test harness in C# to call the same service. Is it
possible? The (XP) .NET class ServiceController is unavailable in compact
framework.

I'd apprecaite if someone can shed some light.

--------------
Charles Chiang
Project Engineer
Pitney Bowes, Embedded Engineering
 
Reply With Quote
 
 
 
 
Paul G. Tobey [eMVP]
Guest
Posts: n/a
 
      15th Nov 2004
That's because services on Windows CE don't behave or look like desktop
services in NT and higher. What are you trying to do to the service?
Start/stop it? ActivateService()? RegisterService?

Paul T.

"Charles Chiang" <(E-Mail Removed)> wrote in message
news:FDCF20F9-9628-4B27-967A-(E-Mail Removed)...
> Hi,
>
> I created a CE Windows Service in C++ and a client test harness. Now I am
> trying to create 2nd test harness in C# to call the same service. Is it
> possible? The (XP) .NET class ServiceController is unavailable in compact
> framework.
>
> I'd apprecaite if someone can shed some light.
>
> --------------
> Charles Chiang
> Project Engineer
> Pitney Bowes, Embedded Engineering



 
Reply With Quote
 
=?Utf-8?B?Q2hhcmxlcyBDaGlhbmc=?=
Guest
Posts: n/a
 
      16th Nov 2004
I would like to invoke the service's XXX_IOControl interface and pass data
buffers in and out via this interface. I'd proven this functionality using
C++ client. The challenge is to make this work using C# and .NET Compact
Framework.

Any suggestion is greatly appreciated.

-c

"Paul G. Tobey [eMVP]" wrote:

> That's because services on Windows CE don't behave or look like desktop
> services in NT and higher. What are you trying to do to the service?
> Start/stop it? ActivateService()? RegisterService?
>
> Paul T.
>
> "Charles Chiang" <(E-Mail Removed)> wrote in message
> news:FDCF20F9-9628-4B27-967A-(E-Mail Removed)...
> > Hi,
> >
> > I created a CE Windows Service in C++ and a client test harness. Now I am
> > trying to create 2nd test harness in C# to call the same service. Is it
> > possible? The (XP) .NET class ServiceController is unavailable in compact
> > framework.
> >
> > I'd apprecaite if someone can shed some light.
> >
> > --------------
> > Charles Chiang
> > Project Engineer
> > Pitney Bowes, Embedded Engineering

>
>
>

 
Reply With Quote
 
Paul G. Tobey [eMVP]
Guest
Posts: n/a
 
      16th Nov 2004
OK, if the 'service' has a stream driver interface, you should be able to do
*exactly* what you did in C++ from C#, although you'll have to P/Invoke to
get to the calls that you need to make. You did something like hdl =
CreateFile( deviceName, ... ), DeviceIoControl( hdl, ... ) in your C++ code?
If so, look at OpenNETCF's SDF. The FileEx class gives you access to
CreateFile() and DeviceIoControl(). If you're calling GetServiceHandle()
and ServiceIoControl() in C++, you'll have to write your own P/Invoke
declarations for those, but they should be pretty similar in form to the
declarations in OpenNETCF.

If you can tell us what you're actually *doing* in C++, you'll get a much
better reply!

Paul T.

"Charles Chiang" <(E-Mail Removed)> wrote in message
news:C5D672EB-D872-46E1-85BF-(E-Mail Removed)...
>I would like to invoke the service's XXX_IOControl interface and pass data
> buffers in and out via this interface. I'd proven this functionality
> using
> C++ client. The challenge is to make this work using C# and .NET Compact
> Framework.
>
> Any suggestion is greatly appreciated.
>
> -c
>
> "Paul G. Tobey [eMVP]" wrote:
>
>> That's because services on Windows CE don't behave or look like desktop
>> services in NT and higher. What are you trying to do to the service?
>> Start/stop it? ActivateService()? RegisterService?
>>
>> Paul T.
>>
>> "Charles Chiang" <(E-Mail Removed)> wrote in
>> message
>> news:FDCF20F9-9628-4B27-967A-(E-Mail Removed)...
>> > Hi,
>> >
>> > I created a CE Windows Service in C++ and a client test harness. Now I
>> > am
>> > trying to create 2nd test harness in C# to call the same service. Is
>> > it
>> > possible? The (XP) .NET class ServiceController is unavailable in
>> > compact
>> > framework.
>> >
>> > I'd apprecaite if someone can shed some light.
>> >
>> > --------------
>> > Charles Chiang
>> > Project Engineer
>> > Pitney Bowes, Embedded Engineering

>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?Q2hhcmxlcyBDaGlhbmc=?=
Guest
Posts: n/a
 
      16th Nov 2004
I'd suspected that might be the most reasonable route after some personal
research. Thank you very much for your help.

FYI, I am using 'GetServiceHandle' and 'ServiceIoControl' in my C++ client
to communicate with the service.

-c

"Paul G. Tobey [eMVP]" wrote:

> OK, if the 'service' has a stream driver interface, you should be able to do
> *exactly* what you did in C++ from C#, although you'll have to P/Invoke to
> get to the calls that you need to make. You did something like hdl =
> CreateFile( deviceName, ... ), DeviceIoControl( hdl, ... ) in your C++ code?
> If so, look at OpenNETCF's SDF. The FileEx class gives you access to
> CreateFile() and DeviceIoControl(). If you're calling GetServiceHandle()
> and ServiceIoControl() in C++, you'll have to write your own P/Invoke
> declarations for those, but they should be pretty similar in form to the
> declarations in OpenNETCF.
>
> If you can tell us what you're actually *doing* in C++, you'll get a much
> better reply!
>
> Paul T.
>
> "Charles Chiang" <(E-Mail Removed)> wrote in message
> news:C5D672EB-D872-46E1-85BF-(E-Mail Removed)...
> >I would like to invoke the service's XXX_IOControl interface and pass data
> > buffers in and out via this interface. I'd proven this functionality
> > using
> > C++ client. The challenge is to make this work using C# and .NET Compact
> > Framework.
> >
> > Any suggestion is greatly appreciated.
> >
> > -c
> >
> > "Paul G. Tobey [eMVP]" wrote:
> >
> >> That's because services on Windows CE don't behave or look like desktop
> >> services in NT and higher. What are you trying to do to the service?
> >> Start/stop it? ActivateService()? RegisterService?
> >>
> >> Paul T.
> >>
> >> "Charles Chiang" <(E-Mail Removed)> wrote in
> >> message
> >> news:FDCF20F9-9628-4B27-967A-(E-Mail Removed)...
> >> > Hi,
> >> >
> >> > I created a CE Windows Service in C++ and a client test harness. Now I
> >> > am
> >> > trying to create 2nd test harness in C# to call the same service. Is
> >> > it
> >> > possible? The (XP) .NET class ServiceController is unavailable in
> >> > compact
> >> > framework.
> >> >
> >> > I'd apprecaite if someone can shed some light.
> >> >
> >> > --------------
> >> > Charles Chiang
> >> > Project Engineer
> >> > Pitney Bowes, Embedded Engineering
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can not communicate with WCF Windows Service Patricio Microsoft Dot NET Framework 3 14th May 2009 04:36 AM
Can't get Intranet ASP Web App to communicate with ASP Web Service? Leo Violette Microsoft ASP .NET 2 21st Apr 2009 08:01 AM
Modem Unable to Communicate with Internet Service Provider =?Utf-8?B?SE1D?= Windows XP Help 3 9th Sep 2005 01:57 PM
Communicate with .net service =?Utf-8?B?SmltIEJha2Vy?= Microsoft Dot NET 1 2nd Jul 2004 12:51 PM
Best way to communicate between Windows Service and GUI? Adam Clauss Microsoft C# .NET 4 5th May 2004 10:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:48 PM.