The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

A DirectX application running as a service?

Don't laugh at me, it isn't my idea. :)

My employer wants us to look into what it will take to make a heavily real time graphics intensive application into a Windows service. The application captures video and displays it using DirectX. It also streams the video over the network. They basically want it to be a "background server" or service that runs at startup, similar to an HTTP or FTP server.

We don't have DirectX dev experience. My question is, what happens when a DirectX application runs as a service, say by using one of the widgets supplied with the Windows Resource Kit?

I'm assuming catastrophic failure. I am also assuming that the app would need to be rewritten in order to make this happen.

Anon for this one Send private email
Friday, August 11, 2006
My application is a video server running as a service, and it uses DirectX heavily. No problem, but you may have to allow the service to interact with the desktop.

It works just like any other application, really. I just have a couple of dozen lines to handle the service-related stuff, everything else is the same as a regular Win32 application.
Friday, August 11, 2006
It's generally a bad idea for a service to have its own user interface. See:;en-us;327618&

You could make your application client-server. The server captures the video, and the client (either local or remote) displays it.
Friday, August 11, 2006
I've written a service that uses DirectShow to access video input devices.  As far as I know, none of the DirectX capabilities are limited by running as a service, although you might not actually get pixels on screen.

If your application requires some interaction before the 'real service' (e.g.: video sent over the network) works, then you'll need to reorganize that part of your application.  Otherwise, your application should work fine.
Kalani Send private email
Saturday, August 12, 2006
Yes, you can do this, by allowing the service to interact with the desktop.  However, it's still an ultra-bad idea.

What happens if the server is running headless, and no one ever logs in?  There'll never be a windowstation created for your app to interact with, and directx will likely report all sorts of strange errors.
Example Send private email
Sunday, August 13, 2006
"What happens if the server is running headless, and no one ever logs in?"

Then he doesn't display anything.

My service starts up and captures video and services network requests before any user logs in. Works fine. When a user logs on he can start a separate client application to interact with the service and display the video. As an optimization I actually blit video frames directly from the service to the client windows instead of bothering with shared memory etc. For something that doesn't need to be as high performance as possible like the application I'm working on you'd probably want to do it in a cleaner way.
Sunday, August 13, 2006

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz