public void SpawnThread(MessageLogForm messageForm) { Thread thread = new Thread(() => ServerThread(messageForm)); serverThreads.Add(thread); thread.Start(); }
public LogMeForm() { InitializeComponent(); CreateHandle(); //callingHandle property should garantee creation, but lets be sure loggerForm = new MessageLogForm(new VirtualWindow(Handle)); //new MessageLogForm(null); loggerForm.Log("init: " + Handle.ToString()); //loggerForm. new VirtualWindow(Handle); loggerForm.Show(); }
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==="); }
public void OpenMessageLog() { if (messageForm == null || messageForm.IsDisposed) { messageForm = new MessageLogForm(this); messageForm.Show(); MainForm.GetNamedPipeServer().SpawnThread(messageForm); if (!isHooked) { Hook(); } } else { messageForm.BringToFront(); messageForm.Focus(); } }