PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET Passing parameter to windows service...

Reply

Passing parameter to windows service...

 
Thread Tools Rate Thread
Old 14-01-2007, 02:00 PM   #1
Hakan Örnek
Guest
 
Posts: n/a
Default Passing parameter to windows service...


Hi ,
I want to parameter passing to my windows sevice. I call service commands
like this ;
'------------------------------------------------------------
Dim sc As ServiceController
sc = New ServiceController("ProsetLogServices")
sc.MachineName = "."
If sc.Status = ServiceControllerStatus.Stopped Then
sc.Start()
End If
sc.ExecuteCommand(129)
'------------------------------------------------------------
This is working but how can I passing parameters to windows service
function...

Thanks for all help...


  Reply With Quote
Old 14-01-2007, 06:02 PM   #2
Michael M.
Guest
 
Posts: n/a
Default Re: Passing parameter to windows service...

Hakan,

Short awnser is:
you can't do this.

Long awnser is:
you will need to use imagination such as combining the command numbers with
external data. IE:

Have a registry key strore the data you need to pass to the function.

So in your client application you write the parameters to the registry key,
call the command (129)

in your service's custom function handler you react to the 129 command by
reading the registry key and passing that data to the service's internal
function.

You might want to write the PID and or Main window handle of your calling
applicaiton to the registry so the service can respond to it uisng custom
windows messages sendmessge(WND,WM_BLAH, PARAM, PARAM)!

There is also he posiblity of "memory mapped files" , "DDE" or Remoting.

Regards,

Mike.



"Hakan Örnek" <ornekh@gmail.com> wrote in message
news:%239aIhR%23NHHA.3544@TK2MSFTNGP03.phx.gbl...
> Hi ,
> I want to parameter passing to my windows sevice. I call service commands
> like this ;
> '------------------------------------------------------------
> Dim sc As ServiceController
> sc = New ServiceController("ProsetLogServices")
> sc.MachineName = "."
> If sc.Status = ServiceControllerStatus.Stopped Then
> sc.Start()
> End If
> sc.ExecuteCommand(129)
> '------------------------------------------------------------
> This is working but how can I passing parameters to windows service
> function...
>
> Thanks for all help...
>
>



  Reply With Quote
Old 15-01-2007, 06:57 AM   #3
Hakan ÖRNEK
Guest
 
Posts: n/a
Default Re: Passing parameter to windows service...

Hi Mike,
Thanks for all help, may be registery using best solutions. Thanks again...

Hakan.



"Michael M." <nospam@mike.com> wrote in message
news:uBUKmZAOHHA.536@TK2MSFTNGP02.phx.gbl...
> Hakan,
>
> Short awnser is:
> you can't do this.
>
> Long awnser is:
> you will need to use imagination such as combining the command numbers

with
> external data. IE:
>
> Have a registry key strore the data you need to pass to the function.
>
> So in your client application you write the parameters to the registry

key,
> call the command (129)
>
> in your service's custom function handler you react to the 129 command by
> reading the registry key and passing that data to the service's internal
> function.
>
> You might want to write the PID and or Main window handle of your calling
> applicaiton to the registry so the service can respond to it uisng custom
> windows messages sendmessge(WND,WM_BLAH, PARAM, PARAM)!
>
> There is also he posiblity of "memory mapped files" , "DDE" or Remoting.
>
> Regards,
>
> Mike.
>
>
>
> "Hakan Örnek" <ornekh@gmail.com> wrote in message
> news:%239aIhR%23NHHA.3544@TK2MSFTNGP03.phx.gbl...
> > Hi ,
> > I want to parameter passing to my windows sevice. I call service

commands
> > like this ;
> > '------------------------------------------------------------
> > Dim sc As ServiceController
> > sc = New ServiceController("ProsetLogServices")
> > sc.MachineName = "."
> > If sc.Status = ServiceControllerStatus.Stopped Then
> > sc.Start()
> > End If
> > sc.ExecuteCommand(129)
> > '------------------------------------------------------------
> > This is working but how can I passing parameters to windows service
> > function...
> >
> > Thanks for all help...
> >
> >

>
>



  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off