Пример #1
0
        public override int RunCore()
        {
            Message msg;
            var     quitMsg = (uint)WM.QUIT;

            bool isMultiThreadedLoopSet = m_hostConfig.GetBooleanValue(CefSettingKeys.MultiThreadedMessageLoop, true);
            bool isExternalPumpSet      = m_hostConfig.GetBooleanValue(CefSettingKeys.ExternalMessagePump, false);

            if (!isMultiThreadedLoopSet && !isExternalPumpSet)
            {
                CefRuntime.RunMessageLoop();
            }
            else
            {
                while (true)
                {
                    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);
        }