title: Paste current time using global hotkey in C#
body: <p>I am trying to paste current time in any windows using C#. So I defined a global hotkey in C# and when I press the hotkey in any windows, the current time is pasted there. </p>
  
  <p>The issue is that it works perfectly with Notepad, but in Notepad++ it pastes the current time just once and then after that it pastes some strange character which is shown by SYN in Notepad++. I added a thread.sleep(500); before paste command and it works in every windows. </p>
  
  <p>So the question is that why without delay it works in Notepad and not in Notepad++? and how I can get rid of the sleep delay in order to make it works in every windows?</p>
  
  <p>Thanks in advance.</p>
  
  <p>here is my code:</p>
  
  <pre><code>    public static void PasteDT()
      {
          ClipPut(DateTime.Now.ToString("HHmmss"));
          //Thread.Sleep(500); //&lt;&lt; without this line it works just once in Notepad++
          SendKeys.SendWait("^v");
      }
  
      public static void ClipPut(string ClipboardText)
      {
          Thread clipboardThread = new Thread(() =&gt; Clipboard.SetText(ClipboardText));
          clipboardThread.SetApartmentState(ApartmentState.STA);
          clipboardThread.IsBackground = false;
          clipboardThread.Start();
          clipboardThread.Join();
      }
  </code></pre>