Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am working on a windows application using c# . I want to retrieve URL from browser. but i am unable to do this .

private void WebListLoad()
{
    ListViewItem lvi;
    Process[] prs = Process.GetProcessesByName("firefox");
    try
    {

    //int handle = int.Parse(Console.ReadLine(), NumberStyles.HexNumber);
    //int txtLength = SendMessage(handle, WM_GETTEXTLENGTH, 0, 0);
    //StringBuilder sb = new StringBuilder(txtLength + 1);
    //SendMessage(handle, WM_GETTEXT, sb.Capacity, sb);


        foreach (Process proces in prs)
        {
            if (proces.MainWindowTitle.Length > 0)
            {
                lvi = listView2.Items.Add(System.Environment.UserName);
                lvi.SubItems.Add("");
                lvi.SubItems.Add(proces.MainWindowTitle.ToString());
                lvi.SubItems.Add(proces.StartTime.ToString());
            }
        }
    }
    catch
    {
    }
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
168 views
Welcome To Ask or Share your Answers For Others

1 Answer

Firefox is a multi-tabbed browser, so getting the address of each of the tabs is not going to be easy.

You will probably need to make a Firefox plugin that communicates with your C# app and supplies it the addresses of the tabs.

Alternatively, see this url: http://social.msdn.microsoft.com/forums/en/csharpgeneral/thread/c60b1699-9fd7-408d-a395-110c1cd4f297


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...