• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 94, comments - 250, trackbacks - 0, articles - 0
              C++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

            Win32控制臺(tái)清屏方法

            Posted on 2010-06-30 20:18 Condor 閱讀(2840) 評(píng)論(0)  編輯 收藏 引用

            最后覺得項(xiàng)目中的控制臺(tái)不大好用,就添加了一些小功能,比如清屏;當(dāng)然最簡(jiǎn)單的方法是調(diào)用系統(tǒng)自帶的函數(shù)system(“cls”);,這里提供一個(gè)方法一樣可以清屏(測(cè)試比cls要快一些):

             

             /* Standard error macro for reporting API errors */ 
             
            #define PERR(bSuccess, api){if(!(bSuccess)) printf("%s:Error %d from %s \ 
                on line 
            %d\n", __FILE__, GetLastError(), api, __LINE__);}

             
            void cls( HANDLE hConsole )
             {
                COORD coordScreen 
            = { 00 };    /* here's where we'll home the
                                                    cursor 
            */ 
                BOOL bSuccess;
                DWORD cCharsWritten;
                CONSOLE_SCREEN_BUFFER_INFO csbi; 
            /* to get buffer info */ 
                DWORD dwConSize;                 
            /* number of character cells in
                                                    the current buffer 
            */ 

                
            /* get the number of character cells in the current buffer */ 

                bSuccess 
            = GetConsoleScreenBufferInfo( hConsole, &csbi );
                PERR( bSuccess, 
            "GetConsoleScreenBufferInfo" );
                dwConSize 
            = csbi.dwSize.X * csbi.dwSize.Y;

                
            /* fill the entire screen with blanks */ 

                bSuccess 
            = FillConsoleOutputCharacter( hConsole, (TCHAR) ' ',
                   dwConSize, coordScreen, 
            &cCharsWritten );
                PERR( bSuccess, 
            "FillConsoleOutputCharacter" );

                
            /* get the current text attribute */ 

                bSuccess 
            = GetConsoleScreenBufferInfo( hConsole, &csbi );
                PERR( bSuccess, 
            "ConsoleScreenBufferInfo" );

                
            /* now set the buffer's attributes accordingly */ 

                bSuccess 
            = FillConsoleOutputAttribute( hConsole, csbi.wAttributes,
                   dwConSize, coordScreen, 
            &cCharsWritten );
                PERR( bSuccess, 
            "FillConsoleOutputAttribute" );

                
            /* put the cursor at (0, 0) */ 

                bSuccess 
            = SetConsoleCursorPosition( hConsole, coordScreen );
                PERR( bSuccess, 
            "SetConsoleCursorPosition" );
                
            return;
             }

             

            天天久久狠狠色综合| 国产成人精品久久| 少妇久久久久久久久久| 久久久久久国产a免费观看不卡| 久久久久免费看成人影片| 97久久国产露脸精品国产| 无码伊人66久久大杳蕉网站谷歌| 国内精品伊人久久久久妇| 欧美精品九九99久久在观看| 亚洲国产日韩欧美久久| 亚洲一级Av无码毛片久久精品| 亚洲精品无码久久不卡| 伊人色综合九久久天天蜜桃| 亚洲欧洲精品成人久久曰影片 | 99久久免费国产精品| 久久精品国产秦先生| 久久久久无码精品| 伊人久久大香线蕉无码麻豆| 一本一道久久综合狠狠老| 国产成人精品免费久久久久| 99热都是精品久久久久久| 日本加勒比久久精品| 天堂久久天堂AV色综合| 国产精品99久久精品爆乳| 亚洲欧美一级久久精品| 久久精品国产99久久无毒不卡| 大美女久久久久久j久久| 亚洲人成无码网站久久99热国产| 久久久无码一区二区三区| 国产成人综合久久久久久| 久久天天躁狠狠躁夜夜avapp| 国产∨亚洲V天堂无码久久久| 精品久久久无码中文字幕| 久久精品国产亚洲AV忘忧草18| 欧美日韩中文字幕久久伊人| 午夜视频久久久久一区| 一级做a爰片久久毛片16| 久久精品国产AV一区二区三区| 久久青草国产手机看片福利盒子| 欧美国产成人久久精品| 国产一级做a爰片久久毛片|