Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Custom Windows Service --help  (Read 2911 times)

0 Members and 1 Guest are viewing this topic.

DaveLembke

    Topic Starter


    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Custom Windows Service --help
« on: November 12, 2008, 12:53:26 PM »
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






BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: Custom Windows Service --help
« Reply #1 on: November 12, 2008, 04:57:57 PM »
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.
I was trying to dereference Null Pointers before it was cool.

DaveLembke

    Topic Starter


    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: Custom Windows Service --help
« Reply #2 on: November 13, 2008, 10:11:10 AM »
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