用户在浏览本站时,无论登录与否,判断在出用户关闭的浏览器是本站最后一页???请高人指点

解决方案 »

  1.   

    再别的地方找的,关闭时出发这个事件,试一试
    通过FindWindow获取IE,取值
     [DllImport("User32.dll")]  
      static extern int FindWindow(string lpClassName, string lpWindowName);
      [DllImport("User32.dll")]
      static extern int FindWindowEx(int hwndParent, int hwndChildAfter, string lpszClass, string lpszWindow);
      [DllImport("User32.dll")]
      static extern int GetWindowText(int hwnd, StringBuilder buf, int nMaxCount);
      [DllImport("User32.dll")]
      static extern int SendMessage(int hWnd, int Msg, int wParam, StringBuilder lParam);
      const int WM_GETTEXT = 0x000D;  
      public static string GetURL()  
      {
      int parent = FindWindow("IEFrame", null);
      int child = FindWindowEx(parent, 0, "WorkerW", null);
      child = FindWindowEx(child, 0, "ReBarWindow32", null);
      child = FindWindowEx(child, 0, "ComboBoxEx32", null);
      child = FindWindowEx(child, 0, "ComboBox", null);
      child = FindWindowEx(child, 0, "Edit", null);   
      StringBuilder buffer = new StringBuilder(1024);
      int num = SendMessage(child, WM_GETTEXT, 1024, buffer);
      string URL = buffer.ToString();
      return URL;
      }