问题标题: 小小cmd2.0发布,鼠标操作很棒

0
0
已解决
杨骐宇
杨骐宇
中级光能
中级光能
#include<bits/stdc++.h>
#include<iostream>
#include<conio.h>
#include<cstdio>
#include<iomanip>
#include<cmath>
#include<windows.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
void color(int ForgC,int BackC){//前景色,背景色
    WORD wColor=((BackC & 0x0F)<<4)+(ForgC & 0x0F);
    SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), wColor);
}
void Slowsay(string s) {
    for (int i = 0; s[i]; i++) {
        cout<<s[i];
        Sleep(10);
    }
}
void Line(string str) {
    int i,l,w;
    w=120;
    l=str.length();
    for(i=0;i<(w-l)/2;i++)
        cout << " ";
}
void mcout(string str){
    Line(str);
    Slowsay(str);
}
string s;
void zhiling1(){
    cout<<"YOS xy-system [版本 1.001]\n(c) YOS-XY Corporation。保留所有权利。\n\n";
    while(1){
        char a[100005];
        string as;
        cout<<"XY-C:\\Users\\XY>";
        getline(cin,as);
        if(as=="return 0"||as=="RETURN 0"){
            break;
        }
        if(as=="tuichu"||as=="TUICHU"){
            system("cls");
            cout<<"不支持退出!!!";
            Sleep(2000);
            break; 
        }
        strcpy(a, as.c_str()); 
        system(a);
    SetConsoleTitle(a);
    }
} 
void hello(){
    system("color 07");
    Slowsay("XY XY-system [版本 1.001]\n(c) XY-SYSTEM Corporation。保留所有权利。\n");
    Slowsay("|\n|\n");
    Slowsay("| 按下左键:常规cmd指令(windows所有指令通用!,输入return 0退出)\n");
    Slowsay("|\n| 按下右键,打开礼包兑换码界面\n");
}
void cmdmain(){
    hello();
    while(1){
        if(KEY_DOWN(VK_LBUTTON)){
            system("cls");
                system("color 07");
            cout<<"XY XY-system [版本 1.001]\n(c) XY-SYSTEM Corporation。保留所有权利。\n";
            cout<<"|\n|\n";
            color(8,0);
            cout<<"| 按下左键:常规cmd指令(windows所有指令通用!,输入return 0退出)\n";
            color(7,0);
            cout<<"|\n| 按下右键,打开礼包兑换码界面\n";
            Sleep(2000);
            system("cls");
            zhiling1();
            system("cls");
            cout<<"\n下次再见!!!"; 
            Sleep(2000);
             HWND hwnd=GetForegroundWindow();
            ShowWindow(hwnd,SW_HIDE);
            break;
        }
        if(KEY_DOWN(VK_RBUTTON)){
            system("cls");
            cout<<"XY XY-system [版本 1.001]\n(c) XY-SYSTEM Corporation。保留所有权利。\n";
            cout<<"|\n|\n";
            cout<<"| 按下左键:常规cmd指令(windows所有指令通用!,输入return 0退出)\n";
            color(8,0);
            cout<<"|\n| 按下右键,打开礼包兑换码界面\n";
            color(7,0);
            Sleep(2000);
            system("cls");
            Slowsay("输入兑换码:"); 
            cin>>s;
            if(s=="xy-is-not-1-years-old-yet-it-is-on-2022"){
                cout<<"欢迎尊贵的开发者!!!\n";
                cout<<"您可以解开所有以后的XY压缩包密码!!,密码是:xYxYxY666\n"; 
                cout<<"按任意键继续...";
                getch();
            }else{
                hello();
            }
        }
    }

}
int main(){
    SetConsoleTitle("cmd");
    HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
    DWORD mode;
    GetConsoleMode(hStdin, &mode);
    mode &= ~ENABLE_QUICK_EDIT_MODE; //移除快速编辑模式
    mode &= ~ENABLE_INSERT_MODE; //移除插入模式
    mode &= ~ENABLE_MOUSE_INPUT;
    SetConsoleMode(hStdin, mode);
    cmdmain();
    return 0;
}

 


0
0
崔皓博
崔皓博
新手光能
新手光能

captchacaptchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptchacaptcha​​​​​​​captchacaptcha​​​​​​​

我要回答