首页 > 解决方案 > 如何在arduino中按WINDOWS + R?

问题描述

我想用 arduino 写一些东西,但它不能打开 WINDOWS+R。我写了这段代码:

#include <Keyboard.h>

// Utility function
void typeKey(int key){
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}

void setup()
{
// Start Keyboard and Mouse
Keyboard.begin();

// Start Payload
// Happy Holidays By Ghostshell

Keyboard.press(KEY_RIGHT_GUI);
Keyboard.press('r');
Keyboard.releaseAll();

delay(1000);

Keyboard.print("notepad.exe");

typeKey(KEY_RETURN);

delay(1000);

Keyboard.print("         _");

typeKey(KEY_RETURN);

Keyboard.print("      |\\ 0 /|");

typeKey(KEY_RETURN);

Keyboard.print("       |/|\\|");

typeKey(KEY_RETURN);

Keyboard.print("         |");

typeKey(KEY_RETURN);

Keyboard.print("         @");

typeKey(KEY_RETURN);

Keyboard.print("        /+\\");

typeKey(KEY_RETURN);

Keyboard.print("       o/@\\\\");

typeKey(KEY_RETURN);

Keyboard.print("     +//o/\\\\o");

typeKey(KEY_RETURN);

Keyboard.print("     //+/@\\\\/+o");

typeKey(KEY_RETURN);

Keyboard.print("    /\\/o//+/\\\\\\\\");

typeKey(KEY_RETURN);

Keyboard.print("   +///\\//\\o\\o+\\\\o");

typeKey(KEY_RETURN);

Keyboard.print("  o/+@/++/\\\\\\@\\\\/\\+");

typeKey(KEY_RETURN);

Keyboard.print(" /\\/+///o/@\\o+/\\+\\\\");

typeKey(KEY_RETURN);

Keyboard.print("o/+/\\/@//||\\/\\\\o\\\\\\o _");

typeKey(KEY_RETURN);

Keyboard.print(" /__ /|  ||      /__ /|");

typeKey(KEY_RETURN);

Keyboard.print("| * | | (__)___ | * | |");

typeKey(KEY_RETURN);

Keyboard.print("|___|/_   /__ /||___|/");

typeKey(KEY_RETURN);

Keyboard.print("    /_/| | * | |");

typeKey(KEY_RETURN);

Keyboard.print("   |_|/  |___|/");

typeKey(KEY_RETURN);

Keyboard.print("     `-.____/");

typeKey(KEY_RETURN);

typeKey(KEY_RETURN);

Keyboard.print("It was the");

typeKey(KEY_RETURN);

Keyboard.print("Night");

typeKey(KEY_RETURN);

Keyboard.print("before");

typeKey(KEY_RETURN);

Keyboard.print("Christmas...");

typeKey(KEY_RETURN);

Keyboard.print("And All Through");

typeKey(KEY_RETURN);

Keyboard.print("The House....");

typeKey(KEY_RETURN);

Keyboard.print("Not A Creature Was");

typeKey(KEY_RETURN);

Keyboard.print("Sturring...");

typeKey(KEY_RETURN);

Keyboard.print("Not Even");

typeKey(KEY_RETURN);

Keyboard.print("A Mouse");

typeKey(KEY_RETURN);

typeKey(KEY_RETURN);

Keyboard.print("Happy Holidays To All!!");



typeKey(KEY_RETURN);

  typeKey(KEY_RETURN);

  Keyboard.print("From");

  typeKey(KEY_RETURN);

  typeKey(KEY_RETURN);

  Keyboard.print("Cheers!!");

  typeKey(KEY_RETURN);

  delay(100);

  // End Payload

  // Stop Keyboard and Mouse
  Keyboard.end();
}

// Unused
void loop() {}

当我在记事本已打开的情况下运行此代码时,它可以工作,但无法打开 WINDOWS+R

标签: arduinoarduino-idepayload

解决方案


推荐阅读