<small id='AswSm'></small><noframes id='AswSm'>

    <i id='AswSm'><tr id='AswSm'><dt id='AswSm'><q id='AswSm'><span id='AswSm'><b id='AswSm'><form id='AswSm'><ins id='AswSm'></ins><ul id='AswSm'></ul><sub id='AswSm'></sub></form><legend id='AswSm'></legend><bdo id='AswSm'><pre id='AswSm'><center id='AswSm'></center></pre></bdo></b><th id='AswSm'></th></span></q></dt></tr></i><div id='AswSm'><tfoot id='AswSm'></tfoot><dl id='AswSm'><fieldset id='AswSm'></fieldset></dl></div>
  1. <tfoot id='AswSm'></tfoot>

      <legend id='AswSm'><style id='AswSm'><dir id='AswSm'><q id='AswSm'></q></dir></style></legend>

      • <bdo id='AswSm'></bdo><ul id='AswSm'></ul>

      DoEvents 等效于 C++?

      时间:2023-08-01

        <i id='Taju6'><tr id='Taju6'><dt id='Taju6'><q id='Taju6'><span id='Taju6'><b id='Taju6'><form id='Taju6'><ins id='Taju6'></ins><ul id='Taju6'></ul><sub id='Taju6'></sub></form><legend id='Taju6'></legend><bdo id='Taju6'><pre id='Taju6'><center id='Taju6'></center></pre></bdo></b><th id='Taju6'></th></span></q></dt></tr></i><div id='Taju6'><tfoot id='Taju6'></tfoot><dl id='Taju6'><fieldset id='Taju6'></fieldset></dl></div>

      • <tfoot id='Taju6'></tfoot>
          <tbody id='Taju6'></tbody>
            <bdo id='Taju6'></bdo><ul id='Taju6'></ul>

              <legend id='Taju6'><style id='Taju6'><dir id='Taju6'><q id='Taju6'></q></dir></style></legend>
            1. <small id='Taju6'></small><noframes id='Taju6'>

                本文介绍了DoEvents 等效于 C++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我是本机 C++ 的新手.现在,我做到了,当我按下鼠标左键时,它有一个 for 循环,它执行 InvalidateRect 并绘制一个矩形,并在每次迭代时按框大小增加 X.但是,C++ 的绘图速度和效率比 C# 快得多,它可以立即绘制所有这些.我想要的是它使矩形无效,显示矩形,等待 50 毫秒,然后继续循环.我试过 Sleep(50) 但它仍然等到绘画完成后再显示结果.我也试过 PeekMessage 但它没有改变任何东西.任何帮助,将不胜感激.谢谢

                I'm new to native c++. Right now, I made it so when I press the left mouse button, it has a for loop that does InvalidateRect and draws a rectangle, and increments X by the box size each time it iterates. But, C++ is so much faster and efficient at drawing than C# that, it draws all this instantly. What I would like is for it to invalidate the rectangle, show the rectangle, wait 50ms, then continue the loop. I tried Sleep(50) but it still waits until painting is done before showing the result. I also tried PeekMessage but it did not change anything. Any help would be appreciated. Thanks

                推荐答案

                DoEvents 基本上翻译为:

                DoEvents basically translates as:

                void DoEvents()
                {
                    MSG msg;
                    BOOL result;
                
                    while ( ::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE ) )
                    {
                        result = ::GetMessage(&msg, NULL, 0, 0);
                        if (result == 0) // WM_QUIT
                        {                
                            ::PostQuitMessage(msg.wParam);
                            break;
                        }
                        else if (result == -1)
                        {
                             // Handle errors/exit application, etc.
                        }
                        else 
                        {
                            ::TranslateMessage(&msg);
                            :: DispatchMessage(&msg);
                        }
                    }
                }
                

                这篇关于DoEvents 等效于 C++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何保证快速关闭我的 win32 应用程序? 下一篇:检测模拟键盘/鼠标输入

                相关文章

                最新文章

                • <bdo id='dFb6t'></bdo><ul id='dFb6t'></ul>

                  <tfoot id='dFb6t'></tfoot>

                    <small id='dFb6t'></small><noframes id='dFb6t'>

                  1. <legend id='dFb6t'><style id='dFb6t'><dir id='dFb6t'><q id='dFb6t'></q></dir></style></legend>
                    <i id='dFb6t'><tr id='dFb6t'><dt id='dFb6t'><q id='dFb6t'><span id='dFb6t'><b id='dFb6t'><form id='dFb6t'><ins id='dFb6t'></ins><ul id='dFb6t'></ul><sub id='dFb6t'></sub></form><legend id='dFb6t'></legend><bdo id='dFb6t'><pre id='dFb6t'><center id='dFb6t'></center></pre></bdo></b><th id='dFb6t'></th></span></q></dt></tr></i><div id='dFb6t'><tfoot id='dFb6t'></tfoot><dl id='dFb6t'><fieldset id='dFb6t'></fieldset></dl></div>