windows service & interact with desktop?
windows service & interact with desktop?
I have a service that needs to appear in the system tray when someone logs in. Anyone know of a trick other than having a 2nd exe run at login?
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: windows service & interact with desktop?
Not the answer to your question, but related: http://www.purebasic.fr/english/viewtop ... 12&t=45057
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
-
LuCiFeR[SD]
- 666

- Posts: 1033
- Joined: Mon Sep 01, 2003 2:33 pm
Re: windows service & interact with desktop?
Personally, I would use the FindWindow API.
just get it to check every so often that the Shell_Traywnd is there... if it is, add the tray Icon. If not, check again in 30 seconds or something.
just get it to check every so often that the Shell_Traywnd is there... if it is, add the tray Icon. If not, check again in 30 seconds or something.
Re: windows service & interact with desktop?
Ah.. So if the service is running under a system account, if administrator logs in, it will be able to interact with that users desktop?LuCiFeR[SD] wrote:Personally, I would use the FindWindow API.
just get it to check every so often that the Shell_Traywnd is there... if it is, add the tray Icon. If not, check again in 30 seconds or something.
Interesting idea worth check into..
-
LuCiFeR[SD]
- 666

- Posts: 1033
- Joined: Mon Sep 01, 2003 2:33 pm
Re: windows service & interact with desktop?
as the administrator, you are in charge of what users get access to whatever program. nothing to stop you checking what level of access a logged in user has and acting accordingly
It won't do it by magic thats for sure hehe
-
LuCiFeR[SD]
- 666

- Posts: 1033
- Joined: Mon Sep 01, 2003 2:33 pm
Re: windows service & interact with desktop?
Actually, let me expand upon this a little...
This is just to give you a rough idea of what I mean...
Code: Select all
Procedure.i FindTaskBar()
If FindWindow_("Shell_TrayWnd",0)
If OpenLibrary(0,"shell32.dll")
*MAlloc = GetFunction(0, "IsUserAnAdmin")
If CallCFunctionFast(*MAlloc) = 1
Debug "Current user is Administrator"
;- Add code to add tray etc here
Else
Debug "Current user is not an Administrator"
;- Decide what to do here if the user is not an administrator
EndIf
CloseLibrary(0)
EndIf
EndIf
EndProcedure
