how to send control + L and control + C to another application?
<p>i am working on win application using c#, i want to send control + L and Control + c when firefox is active, to locate addess bar and copy Url and get info from clipboard. i am trying to do this . but i am enable. </p>

<p>how can i do this?
activate the Firefox window, send Ctrl+L (activates address bar), send Ctrl+C (copy selection, ie. URL, to clipboard) and read the clipboard.</p>

<p>[return: MarshalAs(UnmanagedType.Bool)]
        [DllImport("user32.dll", SetLastError = true)]
        static extern bool PostMessage(IntPtr hwnd, uint Msg, int wParam, int lParam);</p>

<pre><code>    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>
