aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Video/MsgOnlyWindow.cs
blob: 6af5e6a4a4501c83d5f87c3d640f1096c9bdabbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Tango.Video.DirectShow
{
    internal sealed class MsgOnlyWindow : NativeWindow
    {
        private readonly DirectShowPlayer _player = null;
        internal MsgOnlyWindow(DirectShowPlayer player)
        {
            _player = player;

            var cp = new CreateParams { Style = 0, ExStyle = 0, ClassStyle = 0, Caption = GetType().Name };
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                cp.Parent = (IntPtr)(-3); // HWND_MESSAGE
            CreateHandle(cp);
        }
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case DirectShowPlayer.WM_GRAPH_NOTIFY:
                    if (_player != null)
                        _player.HandleEvent();
                    break;
            }
            base.WndProc(ref m);
        }
    }
}