Jump to content

au3 as service help =(


Recommended Posts

Hi, I've been working on an 'Au3 service with menu' type app template using a UDF that I assembled from the work of catchfish, engine, and arcker..

I can't seem to get the compiled script's menu to actually function while the script is in service mode though..

I started out with a couple of different service UDF's from the above guys (many thanks to them for that =)).. but that got the below results:

If I start the compiled script from the SCM it starts the service and the icon apears. If I right click on the scripts tray icon, nothing happens.. UNTIL I stop the service again with the SCM.. then the traymenu appears... but if the tray menu is clicked on, the script ends (since the service was actually stopped by the SCM before the traymenu was "touched" I'm guessing)

So I consolidated the UDFs and cleaned up the conflicts (those three UDF's shared some function names, so I took a function from catchfish's service UDF and arcker's au3-as-service functions and added them to engine's service UDF (replacing the bits arcker had borrowed from sometingwong's service UDF with the ones from engine's UDF due to fuller SCM support, but leaving the actual au3-as-service functions themselves intact, basically)... again, same results as before I assembled the UDF, so I'm back at square 1..

note: the script is configured as a BitOR($SERVICE_WIN32_OWN_PROCESS,$SERVICE_INTERACTIVE_PROCESS), arcker's original example configured the service as $SERVICE_WIN32_OWN_PROCESS..

I know that this script will successfully run as a service using srvany.exe,but I want to be able to use arcker's method and get rid of the constraint of using srvany.exe...

Please help me, source code is attached =)

Changes

----------

version 0.1

=)

version 0.2

Got almost everything in the example script into a function

Renamed the _setpriveledge function to an internal name to avoid conflicts =)

Removed _Service_Status in favor of _Service_QueryStatus in _au3services

_au3services.au3

AServiceMenu.au3

Edited by ShminkyBoy
Link to comment
Share on other sites

thanks for that heads-up with the MSDN link, arcker!

... i did some further testing with the code and it seems the main() function [the 'non-interactive' piece] in my template is indeed firing off, just as you intended with your routines.. so it's still technically working.. just have to get the gui to be supported now..

quick question: does it make sense to change this:

;goto cleanup;
    DllStructSetData($tService_Status, "dwServiceType", $SERVICE_WIN32_OWN_PROCESS)
    DllStructSetData($tService_Status, "dwServiceSpecificExitCode", 0);

to this:

;goto cleanup;
    DllStructSetData($tService_Status, "dwServiceType", _Service_QueryType($sServiceName))
    DllStructSetData($tService_Status, "dwServiceSpecificExitCode", 0);

..in the _service_init() routine? [engine's _service_querytype() function returns the correct value, so if the service is interactive, _service_querytype() will return 0x00000110 as the return value]

[...later on]

I should make any changes to include the 'gui support for interactives' in the _service_servicemain() routine, correct?

/me goes to read more on the msdn site

this would be cool to have complete native service functionality in autoit... it looks to be quite possible on the quick scan of that page you gave me, i'm going to go read more and try!

=)

I've uploaded changes so far to the scripts, see first post.

Edited by ShminkyBoy
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...