Skip to content

Instantly share code, notes, and snippets.

@orange-in-space
Created May 22, 2025 04:03
Show Gist options
  • Select an option

  • Save orange-in-space/d9de4242db6bf70e3ca5f6b0e4063bad to your computer and use it in GitHub Desktop.

Select an option

Save orange-in-space/d9de4242db6bf70e3ca5f6b0e4063bad to your computer and use it in GitHub Desktop.
Simple Send Copilot Key(Copilotキーを送出するだけのやつ><)
// Simple Send Copilot Key
//
// (c) orange_in_space, 2018,2025
// Licence: CC0
//
// HowToUse:
// Simply executing this will send out a Copilot key.
//
// Build:
// VC++2017 or later. "/SUBSYSTEM:WINDOWS"
//
//#include "pch.h"
#include <iostream>
#include <windows.h>
void SendKeyDown(WORD keycode)
{
INPUT data;
memset(&data, 0, sizeof(data));
data.type = INPUT_KEYBOARD;
data.ki.wVk = keycode;
data.ki.wScan = MapVirtualKey(keycode, 0);
data.ki.dwFlags = KEYEVENTF_EXTENDEDKEY;
SendInput(1, &data, sizeof(INPUT));
}
void SendKeyUp(WORD keycode)
{
INPUT data;
memset(&data, 0, sizeof(data));
data.type = INPUT_KEYBOARD;
data.ki.wVk = keycode;
data.ki.wScan = MapVirtualKey(keycode, 0);
data.ki.dwFlags = KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP;
SendInput(1, &data, sizeof(INPUT));
}
void SendCopilotKey()
{
SendKeyDown(VK_LSHIFT);
SendKeyDown(VK_LWIN);
SendKeyDown(VK_F23);
SendKeyUp(VK_F23);
SendKeyUp(VK_LWIN);
SendKeyUp(VK_LSHIFT);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
SendCopilotKey();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment