Exemple #1
0
        private void windowThreadMethod(int x = 0, int y = 0, int width = 800, int height = 600)
        {
            setupInstance(x, y, width, height);

            while (true)
            {
                PInvoke.WaitMessage();

                PInvoke.Message message = new PInvoke.Message();

                if (PInvoke.PeekMessageW(ref message, WindowHandle, 0, 0, 1) != 0)
                {
                    if (message.Msg == PInvoke.WindowsMessage.WM_QUIT)
                    {
                        continue;
                    }

                    PInvoke.TranslateMessage(ref message);
                    PInvoke.DispatchMessage(ref message);
                }
            }
        }
        private void windowThreadMethod(int x = 0, int y = 0, int width = 800, int height = 600)
        {
            setupInstance(x, y, width, height);

            while (true)
            {
                PInvoke.WaitMessage();

                PInvoke.Message message = new PInvoke.Message();

                //Managed Debugging Assistant 'LoaderLock' : 'Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.'
                if (PInvoke.PeekMessageW(ref message, WindowHandle, 0, 0, 1) != 0)
                {
                    if (message.Msg == PInvoke.WindowsMessage.WM_QUIT)
                    {
                        continue;
                    }

                    PInvoke.TranslateMessage(ref message);
                    PInvoke.DispatchMessage(ref message);
                }
            }
        }