• <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++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

            Win32控制臺清屏方法

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

            最后覺得項目中的控制臺不大好用,就添加了一些小功能,比如清屏;當(dāng)然最簡單的方法是調(diào)用系統(tǒng)自帶的函數(shù)system(“cls”);,這里提供一個方法一樣可以清屏(測試比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;
             }

             

            99麻豆久久久国产精品免费| 精品国产青草久久久久福利| 久久久久av无码免费网| 精品久久久久久中文字幕大豆网| 午夜不卡久久精品无码免费| 99久久精品这里只有精品| 亚洲精品tv久久久久| 精品久久8x国产免费观看| 国产99久久九九精品无码| 青青草原精品99久久精品66| 精品久久久久久久中文字幕| 欧美午夜精品久久久久免费视| 久久精品国产精品青草| 一本久久a久久精品亚洲| 国产精品欧美久久久久天天影视| 久久国产色av免费看| 久久久久久亚洲精品不卡| a高清免费毛片久久| 伊人久久精品无码av一区| 国产精品一区二区久久精品无码| 色综合久久中文字幕无码| 久久精品免费大片国产大片| 97久久超碰成人精品网站| 久久婷婷国产剧情内射白浆 | 一本大道久久a久久精品综合| 亚洲精品视频久久久| 国产午夜电影久久| 成人免费网站久久久| 一本一本久久A久久综合精品| 亚洲午夜福利精品久久 | 精品久久久久久国产| 亚洲美日韩Av中文字幕无码久久久妻妇| 国产精品久久免费| 99久久精品影院老鸭窝| 国产美女久久精品香蕉69| 色欲综合久久躁天天躁蜜桃| 人妻少妇久久中文字幕一区二区| 久久天天躁狠狠躁夜夜躁2014| 久久人人爽人人爽人人爽| 亚洲日本va午夜中文字幕久久| 亚洲色欲久久久久综合网|