• 21-11-2013, 14:52:35
    #1
    Arkadaşlar bir projem için ie,frefox ve chrome de o an açık olan url yi öğrenmem gerekiyor.Bu konu hakkında bilgisi olan var ve yardımcı olursa sevinirim.
    Şimdiden herkese teşekkürlerimi sunarım.
    Saygılarımla.
  • 21-11-2013, 15:01:12
    #2
    CoLLeR adlı üyeden alıntı: mesajı görüntüle
    Arkadaşlar bir projem için ie,frefox ve chrome de o an açık olan url yi öğrenmem gerekiyor.Bu konu hakkında bilgisi olan var ve yardımcı olursa sevinirim.
    Şimdiden herkese teşekkürlerimi sunarım.
    Saygılarımla.
    string url = HttpContext.Current.Request.Url.AbsoluteUri;
    // http://localhost:1302/TESTERS/Default6.aspx
    
    string path = HttpContext.Current.Request.Url.AbsolutePath;
    // /TESTERS/Default6.aspx
    
    string host = HttpContext.Current.Request.Url.Host;
    // localhost
    bunu deneyebilir misin...
  • 21-11-2013, 15:08:03
    #3
    devveloper adlı üyeden alıntı: mesajı görüntüle
    string url = HttpContext.Current.Request.Url.AbsoluteUri;
    // http://localhost:1302/TESTERS/Default6.aspx
    
    string path = HttpContext.Current.Request.Url.AbsolutePath;
    // /TESTERS/Default6.aspx
    
    string host = HttpContext.Current.Request.Url.Host;
    // localhost
    bunu deneyebilir misin...
    İlginiz için teşekkür ederim maalesef olmadı bu web(ASP.NET) için geçerli sanırım.
  • 21-11-2013, 15:13:46
    #4
    // there are always multiple chrome processes, so we have to loop through all of them to find the
    // process with a Window Handle and an automation element of name "Address and search bar"
    Process[] procsChrome = Process.GetProcessesByName("chrome");
    foreach (Process chrome in procsChrome) {
      // the chrome process must have a window
      if (chrome.MainWindowHandle == IntPtr.Zero) {
        continue;
      }
    
      // find the automation element
      AutomationElement elm = AutomationElement.FromHandle(chrome.MainWindowHandle);
      AutomationElement elmUrlBar = elm.FindFirst(TreeScope.Descendants,
        new PropertyCondition(AutomationElement.NameProperty, "Address and search bar"));
    
      // if it can be found, get the value from the URL bar
      if (elmUrlBar != null) {
        AutomationPattern[] patterns = elmUrlBar.GetSupportedPatterns();
        if (patterns.Length > 0) {
          ValuePattern val = (ValuePattern)elmUrlBar.GetCurrentPattern(patterns[0]);
          Console.WriteLine("Chrome URL found: " + val.Current.Value);
        }
      }
    }
    şöyle bir kod var. sanırım çalışır 350 ms gecikiyormuş çalışırken ama çok büyük sorun teşkil etmez. O an açık olan chrome sekmesinin adresini buluyormuş. Diğer sekmeye geçersen diğer sekmenin url sini gösterir. Diğer browserları araştıramadım daha.
  • 21-11-2013, 16:31:32
    #5
    VoyL adlı üyeden alıntı: mesajı görüntüle
    // there are always multiple chrome processes, so we have to loop through all of them to find the
    // process with a Window Handle and an automation element of name "Address and search bar"
    Process[] procsChrome = Process.GetProcessesByName("chrome");
    foreach (Process chrome in procsChrome) {
      // the chrome process must have a window
      if (chrome.MainWindowHandle == IntPtr.Zero) {
        continue;
      }
    
      // find the automation element
      AutomationElement elm = AutomationElement.FromHandle(chrome.MainWindowHandle);
      AutomationElement elmUrlBar = elm.FindFirst(TreeScope.Descendants,
        new PropertyCondition(AutomationElement.NameProperty, "Address and search bar"));
    
      // if it can be found, get the value from the URL bar
      if (elmUrlBar != null) {
        AutomationPattern[] patterns = elmUrlBar.GetSupportedPatterns();
        if (patterns.Length > 0) {
          ValuePattern val = (ValuePattern)elmUrlBar.GetCurrentPattern(patterns[0]);
          Console.WriteLine("Chrome URL found: " + val.Current.Value);
        }
      }
    }
    şöyle bir kod var. sanırım çalışır 350 ms gecikiyormuş çalışırken ama çok büyük sorun teşkil etmez. O an açık olan chrome sekmesinin adresini buluyormuş. Diğer sekmeye geçersen diğer sekmenin url sini gösterir. Diğer browserları araştıramadım daha.
    İlgin için çok teşekkür ederim ama buda çalışmadı

    Ben şöyle bir kod buldum fakat kullanamadım.Intptr değeri istiyor onu anlamadım.
    FindWindowEx(intPtr,

     IntPtr hAddressBox = FindWindowEx(intPtr, IntPtr.Zero, "Chrome_OmniboxView", IntPtr.Zero);
                    StringBuilder sb = new StringBuilder(256);
                    SendMessage(hAddressBox, 0x000D, (IntPtr)256, sb);
                    temp = sb.ToString();
  • 22-11-2013, 13:11:54
    #6
    Yokmu bu konuda yardımcı olabilecek.
  • 22-11-2013, 18:04:42
    #7
    CoLLeR adlı üyeden alıntı: mesajı görüntüle
    İlgin için çok teşekkür ederim ama buda çalışmadı

    Ben şöyle bir kod buldum fakat kullanamadım.Intptr değeri istiyor onu anlamadım.
    FindWindowEx(intPtr,

     IntPtr hAddressBox = FindWindowEx([COLOR="Red"]intPtr[/COLOR], IntPtr.Zero, "Chrome_OmniboxView", IntPtr.Zero);
                    StringBuilder sb = new StringBuilder(256);
                    SendMessage(hAddressBox, 0x000D, (IntPtr)256, sb);
                    temp = sb.ToString();
    öncelikle google chromun intPtr'sini aldırtıp gerekli yere yazdırman gerekiyo bu değişken bi tanımdır handle alıp Ptr değerine girersen olabilir belki tam bilmiyorum bu döngüyü sağlaman lazım kod çalışır heralde yada google apilerine bak mutlafa apiler gereklidir bu konu için