Win32 Application development

G

Guest

Dear Windows programmers/specialists,

I am software developer who has been charged with migrating a Windows
application to work seamlessly with Windows terminal server. We're using
C/C++ as our development language.

My application is an "Interactive" Windows service that runs in the
background.When installed in normal Microsoft Windows client systems, the
service
spawns off (using CreateProcess()) a GUI to the default Winsta0
desktop (i.e. the standard Windows desktop) when it detects that a user has
logged in.

On testing this application in a Windows 2000 terminal server, when a user
logs in using remote desktop client, the service runs in the background, but
it fails to lauch the GUI to the desktop that I am using. We want to make
the GUI launch to the desktop of the user(s) logging into the terminal server.

I have been tasked to research this problem. Could it be that we are
launching the GUI to the wrong place? We see the GUI in the task manager,
however, it does not appear on our desktop. If so, how can we make the GUI
program launch to the desktop of the user logged in using remote desktop
client? Is
there a way to figure out the path or name of the desktop that a user is
using and then pass that desktop to
CreateProcess()?

Any Ideas or helpful pointers will be helpful..

Very many thanks in advance.
 
V

Vera Noest [MVP]

I'm a system manager, not a developer, so I won't be able to give
you the whole solution, but I understand the problem.
When you write to Winsta0, you are addressing session 0, which is
the console.
On a single-user system, this is also the users desktop.
On a Terminal Server, this is the physical console desktop, which
always runs in session 0. When normal users opens a session on a
Terminal Server, they will get a different session, with numbers
starting from 1 and going as high as 65535 (starting at 1 again
after a reboot of the server). Icons and error messages that are
visible only on the console (like some systray icons) will not be
visible in user sessions.
So you will have to find the sessionID number of the user which
starts your application. From a command prompt, you can find this
information with the command "qwinsta" (= query winstation; this
works on a single-user desktop as well). How this is done in C/C++
I don't know, but I know that you can retrieve information about
the clients session with the WTSQuerySessionInformation function.

Recommended reading:
Terminal Services Programming Guidelines
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/termserv/termserv/terminal_services_programming_guidelines.asp
 
G

Guest

Dear Vera,

Thank you very much for your input. I do appreciate it. I solved my problem
by putting the GUI program that we're launching in the Startup folder so that
it gets executed within the login session of the person accessing the
terminal server. This addresses the matter.

Many thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top