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

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

DEV-C++软件图标

代码

#include<iostream>
#include<windows.h>
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<<":("<<endl;
    cout<<"The problem has been detected and the window has been closed to prevent damage to your computer.  "<<endl<<"DRIVER_IROL NOT_LESS_OR_EQUAL [mds]If this is the first time you've seen this stop error screen, restart your computer.  "<<endl<<"If the screen appears again, follow these steps: Check to ensure that any new hardware or software has been installed correctly.  "<<endl<<"If this is a new installation, ask your hardware or software manufacturer for any Windows updates you may need.  "<<endl<<"If the problem continues.  Disable or remove any newly installed hardware or software.  Disable BIOS memory options, such as caching or shading.  "<<endl<<" "<<endl<<"If you need NSU safe mode to remove or disable components, restart your computer, press F8 to select advanced startup options, and then select Safe Mode. "<<endl<<" "<<endl<<" "<<endl<<" 'STOP: Ox00000050 (OxFD3094c2, 0x00000001, OxFBFE7617, 0x00000000) "<<endl<<" Sys-address FBFE7617 base at FBFE5000, date stamp 3D6DD67C  "<<endl;
//以上为输出的蓝屏显示文字
  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<iostream>
#include<windows.h>
#include<ctime>
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<<"系统启动中请稍后……"<<endl;
    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;

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值