By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,231 Members | 1,707 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,231 IT Pros & Developers. It's quick & easy.

Passing parameter to windows service...

P: n/a
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...
Jan 14 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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" <or****@gmail.comwrote in message
news:%2******************@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...


Jan 14 '07 #2

P: n/a
Hi Mike,
Thanks for all help, may be registery using best solutions. Thanks again...

Hakan.

"Michael M." <no****@mike.comwrote in message
news:uB*************@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" <or****@gmail.comwrote in message
news:%2******************@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...


Jan 15 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.