コード例 #1
0
ファイル: Form1.cs プロジェクト: gouming/BetterExplorer
        public Form1()
        {
            InitializeComponent();
            try
            {
                WindowsHelper.WindowsAPI.CHANGEFILTERSTRUCT filterStatus = new WindowsHelper.WindowsAPI.CHANGEFILTERSTRUCT();
                filterStatus.size = (uint)Marshal.SizeOf(filterStatus);
                filterStatus.info = 0;
                WindowsAPI.ChangeWindowMessageFilterEx(Handle, 0x4A, WindowsAPI.ChangeWindowMessageFilterExAction.Allow, ref filterStatus);
                WindowsAPI.ChangeWindowMessageFilterEx(Handle, WM_FOWINC, WindowsAPI.ChangeWindowMessageFilterExAction.Allow, ref filterStatus);
                WindowsAPI.ChangeWindowMessageFilterEx(Handle, WM_FOBEGIN, WindowsAPI.ChangeWindowMessageFilterExAction.Allow, ref filterStatus);
                WindowsAPI.ChangeWindowMessageFilterEx(Handle, WM_FOEND, WindowsAPI.ChangeWindowMessageFilterExAction.Allow, ref filterStatus);
                WindowsAPI.ChangeWindowMessageFilterEx(Handle, WM_FOPAUSE, WindowsAPI.ChangeWindowMessageFilterExAction.Allow, ref filterStatus);
                WindowsAPI.ChangeWindowMessageFilterEx(Handle, WM_FOSTOP, WindowsAPI.ChangeWindowMessageFilterExAction.Allow, ref filterStatus);
                WindowsAPI.ChangeWindowMessageFilterEx(Handle, WM_FOERROR, WindowsAPI.ChangeWindowMessageFilterExAction.Allow, ref filterStatus);
            }
            catch (Exception)
            {
                Close();
            }
            _block  = new ManualResetEvent(false);
            _block2 = new ManualResetEvent(false);

            SourceItemsCollection = new List <Tuple <string, string, int> >();
            try {
                SourceHandle = Guid.Parse(Environment.GetCommandLineArgs().Where(c => c.StartsWith("ID:")).Single().Substring(3));
            } catch (Exception) {
            }

            Text = String.Format("FO{0}", SourceHandle);
            MessageReceiverHandle = WindowsAPI.FindWindow(null, "FOMR" + SourceHandle);
            label1.Text           = MessageReceiverHandle.ToString();
            WindowsAPI.SendMessage(MessageReceiverHandle, WM_FOWINC, IntPtr.Zero, IntPtr.Zero);
        }