The ControlService API allows one send a control code to a Win32 service. However, what if I need to send (and receive) more than a control code? What is the best way to establish com开发者_StackOverflowmunication between a user-mode GUI Win32 application and a Win32 service, to exchange arbitrary pieces of data? (Assume I can compile both the service and the application). The method should work from Windows 2000 to Windows 7, and it should work for both the administrators and the standard users. Thanks!
It sounds as though you intend for the service to respond to remote requests. For this, you can use named pipes, as already mentioned. Named pipes, however, are a little more complicated than TCP sockets.
If you take up TCP sockets programming (socket()
, bind()
, listen()
, etc.), you will be able to port that knowledge to other platforms.
You can use pretty much any IPC mechanism. If your service and app are .net based, then the most common solution is to use WCF. For native code service and app, a very common solution is a named pipe. But what choice is best depends on your specific usage needs.
精彩评论