title: What is the easiest way to send and receive data between a .net windows service and an application
body: <p>I have a software that uses a service to encrypt files. The GUI serializes a hashtable containing the file paths, then uses the <code>ExecuteCommand</code> method to notify the service. The service deserializes the hashtable and processes the files. </p>
  
  <p>What I need for the service to do is somehow tell the GUI that it's done processing so the GUI can display some form of notification. What would be the best way for the service to send the data to the GUI? Also if anyone has an alternative to my current method of sending file paths to a service, I am open to suggestions.</p>
  
  <p>EDIT:
  This is what I am doing now:</p>
  
  <pre><code>Dim sk = My.Computer.Registry.LocalMachine.CreateSubKey("SOFTWARE\AesESvc")
  Dim scAES As New ServiceProcess.ServiceController("AesESvc")
  
  sk.SetValue("Processing", 1, Microsoft.Win32.RegistryValueKind.DWord)
  
  scAES.ExecuteCommand(132)
  
  
  Do While (sk.GetValue("Processing") = 1)
      sblProcess.Text = "Processing"
  Loop
  
  Dim total As Int32 = lvwLoad.Items.Count - sk.GetValue("ErrorsInLastProcess")
  
  If total &gt; 1 Then
      sblProcess.Text = (total &amp; " items successfully processed." &amp; vbCrLf &amp; sk.GetValue("ErrorsInLastProcess") &amp; " error(s)")
  ElseIf total = 1 Then
      sblProcess.Text = (total &amp; " item successfully processed." &amp; vbCrLf &amp; sk.GetValue("ErrorsInLastProcess") &amp; " error(s)")
  ElseIf total &lt; 1 Then
      sblProcess.Text = ("None of the items could be processed." &amp; vbCrLf &amp; sk.GetValue("ErrorsInLastProcess") &amp; " error(s)")
  End If
  </code></pre>
  
  <p>The service changes the <code>Processing</code> registry value to 0 when it is finished.</p>