Home > Net >  How to get handle Windows service
How to get handle Windows service

Time:11-20

Windows service how to get handle, master

CodePudding user response:

Maybe you to 'handle' some misunderstanding...

Explain what you want to do, more likely to get valuable discussion,

CodePudding user response:

Oh, yo yo yo, predecessors for 12 years, discuss what you need to do

CodePudding user response:

I did a Windows service, want to let him across the interface to handle, I am a server may multiple interfaces, so do service operation handle inside, so you can only open a service line, otherwise each want to open a software interface, trouble, but I handle the operation on the service can't obtain the handle inside, if the third party software operation,

CodePudding user response:

Send out the boss

CodePudding user response:

I can do that, but the need right,
Right code we are too lazy to write, baidu "win10 serssion0 windowservice"
, of course, I am too lazy to bother, just write in the service process monitoring, and then write a console to operate other (with the above permissions ascend code to start background console to find, so that the console code does not need to consider what permissions, common code is only right to ask to start the service code he)

CodePudding user response:

Windows service not with window directly under the "handle" to the user desktop interface program message,

Because the boundaries of Windows messages on the Desktop,
The
reference https://docs.microsoft.com/en-us/windows/win32/winstation/desktops:
Window messages can be sent only between the processes that are on the same desktop. '


After Windows Vista, due to the service isolation, Windows services will run on the session 0,
The user program running in the session 1, 2, 3...

Session includes WinStation, WinStation include Desktop, therefore, cannot span Session of Windows messages,

Below explanation was made clear:



References from graphics:
https://techcommunity.microsoft.com/t5/ask-the-performance-team/sessions-desktops-and-windows-stations/ba-p/372473

  •  Tags:  
  • C#
  • Related