C++遇到错误蓝屏电脑代码底层分享!

C++遇到错误蓝屏电脑代码底层分享!,第1张

   为了使我们的代码可以运行,请提前下载好用的C++编译器,这里推荐使用DEV-C++,免费好用,可以去360软件管家或Microsoft Store下载。

DEV-C++软件图标

代码

#include
#include
using namespace std;
int full_screen(){            //全屏函数
    HWND hwnd = GetForegroundWindow();
    int cx = GetSystemMetrics(SM_CXSCREEN);
    int cy = GetSystemMetrics(SM_CYSCREEN);
    LONG I_WinStyle = GetWindowLong(hwnd,GWL_STYLE);
    SetWindowLong(hwnd,GWL_STYLE,(I_WinStyle | WS_POPUP | WS_MAXIMIZE) & ~WS_CAPTION & ~WS_BORDER);
    SetWindowPos(hwnd,HWND_TOP, 0, 0, cx, cy, 0);
}
int HideTheCursor(){        //隐藏鼠标
    CONSOLE_CURSOR_INFO cciCursor;
    HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    if(GetConsoleCursorInfo(hStdOut, &cciCursor)){
        cciCursor.bVisible = FALSE;
        SetConsoleCursorInfo(hStdOut, &cciCursor);
    }
}
int main(){
    system("mode 96,28");
    HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
    DWORD mode;
    GetConsoleMode(hStdin, &mode);
    mode &= ~ENABLE_QUICK_EDIT_MODE;
    SetConsoleMode(hStdin, mode);
    HideTheCursor();
    CONSOLE_FONT_INFOEX cfi;
    cfi.nFont = 0;
    cfi.dwFontSize.X = 15;
    cfi.dwFontSize.Y = 30;
    cfi.FontFamily = FF_DONTCARE;
    cfi.FontWeight = FW_NORMAL;
    wcscpy(cfi.FaceName, L"MS Gothic");
    SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
    system("color 1f");            //蓝底白字
    RECT rect;
    HWND hwnd=GetForegroundWindow();
    GetWindowRect(hwnd,&rect);
    MoveWindow(hwnd,-40,-10,8700,1180,TRUE);
    full_screen();
    cout<<":("<     cout<<"The problem has been detected and the window has been closed to prevent damage to your computer.  "< //以上为输出的蓝屏显示文字
  while(2>1){
        HideTheCursor();
        Sleep(1000);
    }
    return 0;
}
/*

以上内容为蓝屏代码,保存时的文件格式为.cpp

编译之后编译器会自动生成.exe文件

F11(台式机)或Alt+F11(笔记本电脑)为编译并运行的快捷键

*/

效果图

/*

知道了如何“蓝屏”,只要稍加加工,就可以蹦迪。

蹦迪原理:

    使用system语句调用cmd命令[e.g. : color 2f ]

具体cmd命令可以摁下Windows徽标键+R调出"运行",输入cmd,在打开的黑窗口中输入 "color help" 。

摁下Windows徽标键+R调出"运行",输入cmd
在打开的黑窗口中输入 "color help"
*/

蹦迪代码如下:

#include
#include
#include
using namespace std;
int full_screen(){
    HWND hwnd = GetForegroundWindow();
    int cx = GetSystemMetrics(SM_CXSCREEN);
    int cy = GetSystemMetrics(SM_CYSCREEN);
    LONG I_WinStyle = GetWindowLong(hwnd,GWL_STYLE);
    SetWindowLong(hwnd,GWL_STYLE,(I_WinStyle | WS_POPUP | WS_MAXIMIZE) & ~WS_CAPTION & ~WS_BORDER);
    SetWindowPos(hwnd,HWND_TOP, 0, 0, cx, cy, 0);
}
int HideTheCursor(){
    CONSOLE_CURSOR_INFO cciCursor;
    HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    if(GetConsoleCursorInfo(hStdOut, &cciCursor)){
        cciCursor.bVisible = FALSE;
        SetConsoleCursorInfo(hStdOut, &cciCursor);
    }
}
int main(){
    cout<<"系统启动中请稍后……"<     system("mode 96,28");
    HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
    DWORD mode;
    GetConsoleMode(hStdin, &mode);
    mode &= ~ENABLE_QUICK_EDIT_MODE;
    SetConsoleMode(hStdin, mode);
    HideTheCursor();
    CONSOLE_FONT_INFOEX cfi;
    cfi.nFont = 0;
    cfi.dwFontSize.X = 15;
    cfi.dwFontSize.Y = 30;
    cfi.FontFamily = FF_DONTCARE;
    cfi.FontWeight = FW_NORMAL;
    wcscpy(cfi.FaceName, L"MS Gothic");
    SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
    system("color 1f");
    RECT rect;
    HWND hwnd=GetForegroundWindow();
    GetWindowRect(hwnd,&rect);
    MoveWindow(hwnd,-40,-10,8700,1180,TRUE);
    full_screen();
    while(1){        //死循环
        system("color 0a");
        cout<<"ROLL GO MDS   ";        //system("color ...")就是cmd中的前景色和背景色命令
        system("color 1a");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color 2a");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color 3a");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color 4a");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color 5a");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color 6a");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color 7a");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color 8a");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color 9a");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color af");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color ba");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color ca");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color da");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color ea");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        system("color fa");
        system("color 0a");
        cout<<"ROLL GO MDS   ";
        cout<<"ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ROLL GO MDS   ";
      //此处的输出可以自定义
    }
    return 0;

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1498326.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-25
下一篇 2022-06-25

发表评论

登录后才能评论

评论列表(0条)

保存