コード例 #1
0
        public override int RunCore()
        {
            Message msg;
            var     quitMsgId = (uint)WM.QUIT;

            do
            {
                if (User32Helpers.PeekMessage(out msg, IntPtr.Zero, 0, 0, PeekMessageFlags.PM_REMOVE))
                {
                    User32Methods.TranslateMessage(ref msg);
                    User32Methods.DispatchMessage(ref msg);
                }
            } while (msg.Value != quitMsgId);
            return(0);
        }
コード例 #2
0
ファイル: HostEventLoop.cs プロジェクト: ztxyzu/Chromely
        /// <summary>
        /// The run core.
        /// </summary>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        public override int RunCore()
        {
            var quitMsg = (uint)WM.QUIT;

            bool isMultiThreadedLoopSet = this.mHostConfig.GetBooleanValue(CefSettingKeys.MultiThreadedMessageLoop, true);
            bool isExternalPumpSet      = this.mHostConfig.GetBooleanValue(CefSettingKeys.ExternalMessagePump);

            if (!isMultiThreadedLoopSet && !isExternalPumpSet)
            {
                CefRuntime.RunMessageLoop();
            }
            else
            {
                while (true)
                {
                    Message msg;
                    if (User32Helpers.PeekMessage(out msg, IntPtr.Zero, 0, 0, PeekMessageFlags.PM_REMOVE))
                    {
                        if (msg.Value == quitMsg)
                        {
                            break;
                        }

                        User32Methods.TranslateMessage(ref msg);
                        User32Methods.DispatchMessage(ref msg);
                    }

                    // Do your idle processing
                    if (isExternalPumpSet)
                    {
                        CefRuntime.DoMessageLoopWork();
                    }
                }
            }

            return(0);
        }