Advertisement
roeil

Do Command

Dec 14th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3.  
  4. void Input()
  5. {
  6.     INPUT space = { 0 };
  7.     space.type = INPUT_KEYBOARD;
  8.     space.ki.wVk = VK_LMENU;
  9.     SendInput(1, &space, sizeof(INPUT));
  10. }
  11.  
  12. int main()
  13. {
  14.     HWND hHandle = FindWindow(NULL, "File Explorer");
  15.     if (hHandle == NULL) {
  16.         std::cout << "Cannot FindWindow!";
  17.         Sleep(20000);
  18.     } else {
  19.         std::cout << "Window Found!";
  20.         DWORD procID;
  21.         GetWindowThreadProcessId(hHandle, &procID);
  22.         HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID);
  23.  
  24.         while (true)
  25.         {
  26.             for (;;) {
  27.                 if (GetKeyState('A') & 0x8000)
  28.                 {
  29.                     Input();
  30.                 }
  31.             }
  32.         }
  33.     }
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement