public string GetActiveWindowTitle()
 {
     try
     {
         IntPtr foregroundWindow      = GWH.GetForegroundWindow();
         uint   lpdwProcessId         = 0;
         int    windowThreadProcessId = (int)GWH.GetWindowThreadProcessId(foregroundWindow, out lpdwProcessId);
         string processName           = Process.GetProcessById((int)lpdwProcessId).ProcessName;
         if (processName == "explorer" || processName == "WWAHost")
         {
             return(this.GetTitle(foregroundWindow));
         }
         string str = FileVersionInfo.GetVersionInfo((string)new ManagementObjectSearcher(string.Format("SELECT ProcessId, ExecutablePath FROM Win32_Process WHERE ProcessId LIKE '{0}'", (object)lpdwProcessId.ToString())).Get().Cast <ManagementObject>().FirstOrDefault <ManagementObject>()["ExecutablePath"]).FileDescription;
         if (str == "")
         {
             str = this.GetTitle(foregroundWindow);
         }
         return(str);
     }
     catch
     {
         return("");
     }
 }