title: how to send control + L and control + C to another application?
body: <p>I am working on win application using c#, I want to send <kbd>Ctrl</kbd>+ <kbd>L</kbd> and <kbd>Ctrl</kbd> + <kbd>C</kbd> when firefox is active, to locate address bar and copy Url and get info from the clipboard. I am trying to do this. but I am not able to do so. </p>
  
  <p>how can I do this?
  activate the Firefox window, send <kbd>Ctrl</kbd>+ <kbd>L</kbd> (activates address bar), send <kbd>Ctrl</kbd> + <kbd>C</kbd> (copy selection, ie. URL, to clipboard) and read the clipboard.</p>
  
  <pre><code> [return: MarshalAs(UnmanagedType.Bool)]
      [DllImport("user32.dll", SetLastError = true)]
      static extern bool PostMessage(IntPtr hwnd, uint Msg, int wParam, int lParam);
  
      private const uint VK_CONTROL = 0x11;
      private const uint VK_L = 0x4C;
      private const uint VK_C = 0x43;
  
  
  if (hwndfirfox == Process.GetProcessesByName("firefox")[0].MainWindowTitle)
         hwndfirfox = Process.GetProcessesByName("firefox")[0].MainWindowHandle;
  
  if (hwndfirfox != null)
  {
      PostMessage(hwndfirfox, VK_CONTROL, VK_L, 0);
      PostMessage(hwndfirfox, VK_CONTROL, VK_C, 0);
  }
  </code></pre>
  
  <p>this code is giving error, help me .</p>