• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • windows的消息循環

    發表于:2013-06-21來源:Csdn作者:terrycanny點擊數: 標簽:windows
    GetMesssge函數的返回值可非零、零或-1,應避免如下代碼出現: [cpp] view plaincopyprint? while (GetMessage( lpMsg, hWnd, 0, 0))

      GetMesssge函數的返回值可非零、零或-1,應避免如下代碼出現:

      [cpp] view plaincopyprint?

      while (GetMessage( lpMsg, hWnd, 0, 0))

      {

      TranslateMessage(&Msg);

      DispatchMessage(&Msg);

      }

      while (GetMessage( lpMsg, hWnd, 0, 0))

      {

      TranslateMessage(&Msg);

      DispatchMessage(&Msg);

      }

      -1返回值的可能性表示這樣的代碼會導致致命的應用程序錯誤。

      可修改為:

      [cpp] view plaincopyprint?

      while(GetMessage(&Msg, NULL, 0, 0) > 0)

      {

      TranslateMessage(&Msg);

      DispatchMessage(&Msg);

      }

      while(GetMessage(&Msg, NULL, 0, 0) > 0)

      {

      TranslateMessage(&Msg);

      DispatchMessage(&Msg);

      }

      或

      [cpp] view plaincopyprint?

      BOOL bRet;

      while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)

      {

      if (bRet == -1)

      {

      // handle the error and possibly exit

      }

      else

      {

      TranslateMessage(&msg);

      DispatchMessage(&msg);

      }

      }

    原文轉自:http://blog.csdn.net/terrycanny/article/details/8622492

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>