Ejemplo n.º 1
0
        private void ServerThread(object messageForm)
        {
            MessageLogForm        messageLog = (MessageLogForm)messageForm;
            NamedPipeServerStream pipeServer = new NamedPipeServerStream("spyminuspipe", PipeDirection.InOut, 254, PipeTransmissionMode.Message, PipeOptions.Asynchronous);

            messageLog.Log("Waiting for connections....");
            pipeServer.WaitForConnection();
            messageLog.Log(string.Format("Client connected on thread[{0}].", Thread.CurrentThread.ManagedThreadId));

            do
            {
                NativeMethods.CWPSTRUCT cwp = ReadCWPStruct(pipeServer);
                messageLog.Log(cwp);
            } while (pipeServer.IsConnected);


            pipeServer.Close();
            messageLog.Log("===pipe closed===");
        }
Ejemplo n.º 2
0
 internal void Log(NativeMethods.CWPSTRUCT cwp)
 {
     Log($"h:{cwp.hwnd,-10} m:{cwp.message,-10} w:{cwp.wParam,-10} l:{cwp.lParam,-10}");
     messageCount++;
 }