Jump to content
  • Advertisement
Sign in to follow this  

service and GUI in c++

This topic is 3767 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Well I have made one service for windows server that installs and starts just fine. After last update on service I have noticed some errors, that service handles but I can't really see whats happened. On my local machine where I develop everything is working again fine. So I need some GUI for service running on remote computer. What is best way to make GUI for service? I have thought about making one simple dialog and via WM_USER messages to try to communicate between two programs, but it is not so elegant solution. Making GUI from inside service is again unpredictable because if two or more users connect from remote desktop onto server, and check GUI I don't really know what will happen. So what you think?

Share this post

Link to post
Share on other sites
First of all your service should not contain any gui parts at all.

Services are started BEFORE any gui parts of Windows is loaded, hence it can't use Window's gui functions (you can actually do it but in this case I wouldn't recommend it).

Instead, create the gui as a separate Windows application that communicates with the service application using Inter Process Communication (IPC).

For this case I think that a named pipe is the way to go.

On service start: Call CreateNamedPipe with the name "\\.\pipe\MyTestPipe" (for instance).
On gui app start: Call CreateFile or CallNamedPipe with the name \\MyServerComputerName\pipe\MyTestPipe" (for instance).

Edit: fixed links.

Share this post

Link to post
Share on other sites

I have made some communication between GUI program and the service with named pipes, but I need to make pipes unique to the user because there is a possibility that more than one user will activate GUI and try to communicate with service.

So I have two more questions.

First thought is to get users ID, and I found WTSGetActiveConsoleSessionId command
but it always return to me 0. I tried to connect as two users onto remote desktop and started program which shows SessionId and in both cases it returned zero, while from task manager/users I got that user id's are 2 and 3.
Maybe I'm using wrong command, but i didn't found any other.

So which is the right command to get user Id or some unique number/text that I can use to create several unique named pipes?

Second question: is there any notification message that broadcasts to all programs that new user is logging on/off?


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!