Visual Basic 6 Service and Vista: A program can't display a message on your desktop...

Posted on 2009-02-15
Last Modified: 2013-11-26
We've a legacy Visual Basic 6.0 project that runs as a service using srvany.exe file.
It runs as a local service and some times displays a message in a window.
Recently we wanted to use this program in Windows Vista, every thing works well, except the displaying forms.

"A program can't display a message on your desktop" appears and when clicking "Show me the message" button, the app's window in displayed.

As I searched for this problem, this is described as below:
You have a service, or an app running as one, that is trying to pop-up a window from the SYSTEM (session 0) desktop to your logged-on
session. By default, this is NOT allowed anymore - it worked in XP/2003/downlevel OSes because in those OSes, you logged into session 0, but not so anymore in Vista / Server 2008.

How can I tell my service to display a window in the current running user's desktop, not the session 0 (System)?

Or an alternative way to solve this problem?

As I said earlier, I'm using Visual Basic 6.0 and my service is being run using srvany

Any comment would be highly appreciated.
Question by:Mortaza Doulaty
    LVL 16

    Expert Comment

    Can the service execute another program?
    If so, you could write a simple application that displays a message from a command line or from a temporary file, and call this application from the service.
    LVL 12

    Author Comment

    by:Mortaza Doulaty
    I have to test it, but if the service executes another program, that program is also executed as system, not the user, and the same problem will still exists...
    LVL 12

    Author Comment

    by:Mortaza Doulaty
    No luck, still the same problem.
    LVL 5

    Accepted Solution

    Can't be done. Interactive services are not allowed under Vista.

    You will need to implement a TCP/IP or UDP conversation between the level 0 (system) service and a simple noddy app which MUST be executed in the context of ALL users who logon as active desktop sessions.

    The noddy just needs to "listen" for the "service conversation" and on receipt, display the appropriate message on behalf of the service.
    LVL 12

    Author Comment

    by:Mortaza Doulaty
    Dear David_Ward,

    Thanks for your comment.
    Can you post some sample apps with a TCP/IP or UDP conversation between level 0 and a simple app?
    LVL 5

    Expert Comment

    It is just a perfectly ordinary TCP/IP or UDP conversation the fact that one side is a level 0 service and the other end is a level ?n+ app has no bearing on the matter, network data crosses those divides with no special handling.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now