1.

Solve : Custom Windows Service --help?

Answer»

Hello I am trying to get WINDOWS media player to run from a service on 3 windows 2000 PRO sp4 systems. The reason for the service is to start and stop windows media player remotely so that I can add a routine into my batch process which will NET STOP copy the latest onhold.mp3 file to the 3 systems, then NET START to launch mplayer2.exe /play onhold.mp3 at c:\onhold on these 3 systems.

I used the process linked here http://www.tacktech.com/display.cfm?ttid=197

to be able to create a custom windows service named onhold and everything works EXCEPT for Windows Media Player will not launch and I get an error message of:

---------------------------------------------------------------------------------
Microsoft Management Console                                                [X]

Could not start the OnHold service on Local Computer
Error 1053: The service did not respond to the start or control request in a timely fashion.

                                                          [ OK ]
---------------------------------------------------------------------------------

Here is the registry tree that references to my custom created service:

HKEY_LOCAL_MACHINE
        |
        L SYSTEM
              |
               L CURRENT CONTROL SET
                              |
                              L SERVICES
                                       |
                                       L OnHold
                                              |
                                              L ENUM
                                              |
                                              L PARAMETERS
                                              |
                                              L SECURITY

Under the OnHold there is a ImagePath instruction set to Type Of = Reg_Expand_SZ pointing to c:\onhold\mplayer2.exe to trigger windows media player to hopefully launch when the service is started, but I get the failure above when trying to start it.

When initially creating the service following the directions linked in that URL, the service can start and stop fine, but nothing happens. But when I GO to alter the ImagePath to point to c:\onhold\mplayer2.exe instead of its default setting of c:\onhold\srvany.exe it errors out with the message above.

In addition to this I created the key of Parameters between Enum and Security and set up Application with Type Of REG_SZ, and Data of c:\onhold\mplayer2.exe but it still comes up with the same error message when starting the service.

Once I can get this to launch the windows media player correctly I will alter this to point to the onhold.mp3, but just trying to get it to function at this point.

Any suggestions as to what I am doing wrong. Are windows GUI apps not cabable of starting as a service object, and only console apps supported for this???

Thanks,

Dave





srvany is a stub program used to make any program a service. It essentially calls into the program specified for itself- found elsewhere in the registry.


You would need to write your own service that performs the tasks you want- starting media player when you wish and closing media player when it stops.

The problem is- Media player, even if you manage to make it into a service, will cause all sorts of problems, since services are designed to not have a User Interface at all.Thanks for your help... That makes sense now.

I will try that and see where that leads then and report back if I hit any other ISSUES for help.

Thanks



Discussion

No Comment Found