C# Get active-url von Aktiven Prozess

Grüße

Ich bin mit dem folgenden code ein, um den aktiven Prozess.

[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)]
public extern short GetKeyState(int keyCode);
[DllImport("user32.dll")]
private extern Int32 GetWindowThreadProcessId(
    IntPtr hWnd, out uint lpdwProcessId);

[DllImport("user32.dll")]
private extern IntPtr GetForegroundWindow();

private Process GetProcessByHandle(IntPtr hwnd)
{
    try
    {
        uint processID;
        GetWindowThreadProcessId(hwnd, out processID);
        return Process.GetProcessById((int)processID);
    }
    catch { return null; }
}

private Process GetActiveProcess()
{
    IntPtr hwnd = GetForegroundWindow();
    return hwnd != null ? GetProcessByHandle(hwnd) : null;
}

Ich Frage mich, ob mit diesem oder einem anderen code, den ich bekommen konnte, die aktive URL /Tab von einem beliebigen webbrowser, wenn GetActiveProcess gibt einen webbrowser als aktiver Prozess?

Grüße

von einem beliebigen webbrowser? Hmm, Nein.

InformationsquelleAutor Theun Arbeider | 2011-04-18

Schreibe einen Kommentar