Jump to content

Send Commands to a Service?


Recommended Posts

I've written a service in AutoIt using the _Service UDF:http://www.autoitscript.com/forum/index.php?showtopic=80201&st=0

Now what I want to do is send a custom command from a C# app to the AutoIt service.

It's shown how this is done in a C# service here: http://arcanecode.com/2007/05/30/windows-services-in-c-sending-commands-to-your-windows-service-part-7/

But does anyone know how that might be accomplished for the AutoIt service or IF it can be done?

Thanks

Edited by cvocvo
Link to comment
Share on other sites

You can use the WMI Win32_Service object and $oSvc.UserControlService($iCmd). Note $iCmd is defined by WMI as uint8 (one byte), so only 0 thru 255 are valid.

Also, I've learned anything you could reach in WMI can be reached with a sufficiently clever DllCall() too, if you're willing to do a little research.

:blink:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hello,

Did you do it with autoit? I want to do the same but with autoit...

You can use the WMI Win32_Service object and $oSvc.UserControlService($iCmd). Note $iCmd is defined by WMI as uint8 (one byte), so only 0 thru 255 are valid.

Also, I've learned anything you could reach in WMI can be reached with a sufficiently clever DllCall() too, if you're willing to do a little research.

:blink:

Link to comment
Share on other sites

Not sure. I thought you wanted to send commands to a service. You want an AutoIt-based service to receive such commands.

That probably means setting up a COM event handler for when your service's object gets a "UserControlService" event, or something similar.

:blink:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...