Beispiel #1
0
        private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            if (msg == OverlayMessage.WM_HOTKEY)
            {
                // we need the high-order word to get the virtual key code.
                // low-order word specifies the keys that were to be pressed in combination with the virtual key code - in our case none
                toggleRecordingKeyboardHook.OnHotKeyEvent(lParam.ToInt32() >> 16);
                toggleVisibilityKeyboardHook.OnHotKeyEvent(lParam.ToInt32() >> 16);
                toggleGraphVisibilityKeyboardHook.OnHotKeyEvent(lParam.ToInt32() >> 16);
                toggleBarVisibilityKeyboardHook.OnHotKeyEvent(lParam.ToInt32() >> 16);
                toggleLagIndicatorVisibilityKeyboardHook.OnHotKeyEvent(lParam.ToInt32() >> 16);
            }
            else if (msg == OverlayMessage.overlayMessage)
            {
                OverlayMessageType messageType = (OverlayMessageType)wParam.ToInt32();
                overlayTracker.ReceivedOverlayMessage(messageType, lParam);
            }
            else if (msg == presentMon.GetPresentMonRecordingStopMessage())
            {
                ToggleRecordingKeyDownEvent(); // Signal the recording to stop.
            }

            UpdateUserInterface();
            return(IntPtr.Zero);
        }
Beispiel #2
0
        public void ReceivedOverlayMessage(OverlayMessageType messageType, IntPtr lParam)
        {
            Debug.Print(messageType.ToString() + " " + lParam.ToString());
            int lParamValue = lParam.ToInt32();

            switch (messageType)
            {
            case OverlayMessageType.AttachDll:
                injectedProcesses.Add(lParamValue);
                hookedProcesses.Add(lParamValue);
                break;

            case OverlayMessageType.DetachDll:
                injectedProcesses.Remove(lParamValue);
                hookedProcesses.Remove(lParamValue);
                break;

            case OverlayMessageType.ThreadInitialized:
                overlayThreads.Add(lParamValue);
                break;

            case OverlayMessageType.ThreadTerminating:
                overlayThreads.Remove(lParamValue);
                break;

            //Remove overlay process from the list of injected processes
            case OverlayMessageType.Initialized:
                injectedProcesses.Remove(lParamValue);
                break;

            default:
                break;
            }
        }
Beispiel #3
0
        public void ToggleOverlayVisibility()
        {
            showOverlay = !showOverlay;
            OverlayMessageType messageType = showOverlay ? OverlayMessageType.ShowOverlay : OverlayMessageType.HideOverlay;

            SendMessageToOverlay(messageType);
        }
Beispiel #4
0
        private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            if (msg == OverlayMessage.overlayMessage)
            {
                OverlayMessageType messageType = (OverlayMessageType)wParam.ToInt32();
                overlayTracker.ReceivedOverlayMessage(messageType, lParam);
            }
            else if (msg == presentMon.GetPresentMonRecordingStopMessage())
            {
                TogglePresentMonRecording(); // Signal the recording to stop.
            }

            UpdateUserInterface();
            return(IntPtr.Zero);
        }
Beispiel #5
0
        /// <summary>
        ///  Send the given message to the overlay and remove every invalid thread.
        /// </summary>
        public void SendMessageToOverlay(OverlayMessageType message)
        {
            List <int> invalidThreads = new List <int>();

            foreach (var threadID in overlayThreads)
            {
                if (!PostThreadMessage(threadID, OverlayMessage.overlayMessage, (IntPtr)message, IntPtr.Zero))
                {
                    Debug.Print("Send message to overlay failed " + GetLastError().ToString() + " removing thread " + threadID.ToString());
                    invalidThreads.Add(threadID);
                }
            }

            foreach (var threadID in invalidThreads)
            {
                overlayThreads.Remove(threadID);
            }
        }