windows service & interact with desktop?
Posted: Tue Jan 18, 2011 6:04 pm
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?
http://www.purebasic.com
https://www.purebasic.fr/english/
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.
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