Hi,
I have previously posted in the coding questions but the subtopic is more relevant.
I need to display a message to the logged on from a service, Windows XP allows me to do this but in Vista upwards session 0 is segregated from a logged on user for security reasons and requires a different approach.
My service uses SERVICE_INTERACTIVE_PROCESS and my MessageBox has the MB_SERVICE_NOTIFICATION flag.
I have found some resources regarding allowing interaction : http://msdn.microsoft.com/en-us/library ... 85%29.aspx but they are way over my head and I am not sure what I may need to include
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
How do I display a message to user from service Win 7?
How do I display a message to user from service Win 7?
----
R Tape loading error, 0:1
R Tape loading error, 0:1
-
buddymatkona
- Enthusiast

- Posts: 252
- Joined: Mon Aug 16, 2010 4:29 am
Re: How do I display a message to user from service Win 7?
Here is a suggested way (with source) to create an interactive service on Vista/7.
The MSI you provide installs with one UAC popup to run as Admin...followed by a Reboot. After that the service should work as in XP. Hope it helps.
http://www.codeproject.com/KB/vista-sec ... sg=3316993
The MSI you provide installs with one UAC popup to run as Admin...followed by a Reboot. After that the service should work as in XP. Hope it helps.
http://www.codeproject.com/KB/vista-sec ... sg=3316993
Re: How do I display a message to user from service Win 7?
Thanks for the info, however I don't think PB has support for some of the API functions, like WTSGetActiveConsoleSessionId. Unless I am missing something....
----
R Tape loading error, 0:1
R Tape loading error, 0:1
-
buddymatkona
- Enthusiast

- Posts: 252
- Joined: Mon Aug 16, 2010 4:29 am
Re: How do I display a message to user from service Win 7?
@ em_uk
The good news is standard PB tools are enough to do API calls yourself.
In the case of WTSGetActiveConsoleSessionId, do this:
Good Luck 
The good news is standard PB tools are enough to do API calls yourself.
In the case of WTSGetActiveConsoleSessionId, do this:
Code: Select all
Prototype ProtoConsoleSessionId() ; Prototype.d was my first guess and wrong - when in doubt, let PB handle parameter types
If OpenLibrary(0, "Kernel32.DLL")
SessionId.ProtoConsoleSessionId = GetFunction(0, "WTSGetActiveConsoleSessionId")
Result = SessionId()
Debug Result ; on Windows 7 (System SessionId = 0) with a single user owning the console, you should get Result = 1
CloseLibrary(0)
EndIfRe: How do I display a message to user from service Win 7?
Wow! That's a real help! Thanks man! Seriously...
----
R Tape loading error, 0:1
R Tape loading error, 0:1