Re: Need a non-interactive service to open dialog on input desktop
- From: logical1 <logical1@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 12 Jul 2006 05:43:02 -0700
Thanks for the reply. I inherited this code and the person that designed the
system is no longer with the company. I've never worked with COM/DCOM before
so I wasn't sure if going that route was a reasonable approach. I really
don't know why a service was used in the first place, after all, the service
is started by the user clicking on a button in another "regular" application.
So, if I make it an application rather than a service, then it can still
make remote COM calls to a remote COM object?
"Brian Muth" wrote:
.
"logical1" <logical1@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:998AE7DD-0627-45A4-9864-F9672EE7DA57@xxxxxxxxxxxxxxxx
Background: I had an interactive service (running as Local System
account)
on machine A and another interactive service (running as Local System
account) on machine B. On NT, either of these services was able to
remotely
connect to the other. Now, I need this to work on XP. I've found out
that a
service running as Local System cannot access a remote server. So... I've
changed the way I create the service - removed SERVICE_INTERACTIVE_PROCESS
and added account name and password. In this way, the service is now a
non-interactive service. The account name/password is the same account
name/password as the user that is logged on and starts the service (via
another application). Furthermore, this user is an administrator on both
machine A and machine B. However, my service still needs to
create/display a
dialog. I found an example for a noninteractive service application to
interact with the user by opening the user's window station and desktop.
So,
I modified the service to do this.
Problem: When the service is started, it does not display the dialog
properly on the screen. I can tell that the service is running because
when
I mimize every winodw, there is a portion of the screen that is not
repained.
This is actually the size of the dialog that is supposed to be displayed,
but it does not in anyway resemble a window - there is no frame or window
controls, etc. The service is reported as started and I can stop it
manually
from the Services window. To simplify things, I tried just displaying a
simple MessageBox - see code segment below:
m_hwinsta = ::OpenWindowStation("WinSta0", FALSE, MAXIMUM_ALLOWED);
::SetProcessWindowStation(m_hwinsta);
m_hdesktop = ::OpenDesktop("Default", 0, FALSE, MAXIMUM_ALLOWED);
::SetThreadDesktop(m_hdesktop);
::MessageBox(NULL,
"This is a message box.",
"Title",
MB_OK);
Again, the message box is not really displayed. If I minimize all the
windows again, I can see a portion of the screen that is not repainted
which
is the size of the message box but there is no frame or controls drawn. I
can click in the region where the title bar is and move it around and I
can
guess where the OK button is and get the "window" to close, but really,
you
can't even tell that it is a message box. If I add either of the styles
MB_DEFAULT_DESKTOP_ONLY or MB_SERVICE_NOTIFICATION to the message box,
then
it displays fine. However, that does not fix things for me because I
don't
really want to display a message box. I want to display my specific
dialog.
Can anyone help please? I've been beating my head against a wall for
weeks
now trying to get this thing to work under XP.
Why scale a 20 foot wall, when you can get where you want by scaling a 1
foot wall? Instead of using a service, use a plain executable instead. If
you want it to start automatically, add it to the "Start" menu list so that
it is launched when the user logs on. That executable will be able to draw
on the user's desktop whenever it wants (or more likely, whenever told to by
machine A).
Services should NEVER write to the desktop. The user may not be logged in,
or may not be present to read the dialog box.
Brian
- Follow-Ups:
- Re: Need a non-interactive service to open dialog on input desktop
- From: Brian Muth
- Re: Need a non-interactive service to open dialog on input desktop
- References:
- Re: Need a non-interactive service to open dialog on input desktop
- From: Brian Muth
- Re: Need a non-interactive service to open dialog on input desktop
- Prev by Date: Re: Proxy vs Custom marshalling
- Next by Date: Re: What is COINIT_DISABLE_OLE1DDE mean in CoInitializeEx
- Previous by thread: Re: Need a non-interactive service to open dialog on input desktop
- Next by thread: Re: Need a non-interactive service to open dialog on input desktop
- Index(es):