metalx1000

GCC Windows Hide Current Windows with Key Press

Dec 21st, 2017
819
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include<iostream>
  2. #include<windows.h>
  3. #include<winuser.h>
  4. #include <string>
  5. using namespace std;
  6.  
  7. //Warning Currently this program only remembers one Window
  8. //So, if you hide two windows, it can only bring back the last Window
  9. //the first will remain hidden
  10.  
  11. //Key Table http://www.kbdedit.com/manual/low_level_vk_list.html
  12.  
  13. int main(){
  14.     HWND hWnd;
  15.    
  16.     while(true){
  17.  
  18.         //Press Left Shift and H to hide Current Window
  19.         if (GetAsyncKeyState(VK_LSHIFT)){
  20.             Sleep(500);
  21.             if(GetAsyncKeyState(0x48)){
  22.                 hWnd = GetForegroundWindow();
  23.                 ShowWindow( hWnd, SW_HIDE );
  24.                 ShowWindow( hWnd, SW_HIDE );
  25.             }
  26.         }
  27.        
  28.         //Press Left Shift and S to Bring Window Back
  29.         if (GetAsyncKeyState(VK_LSHIFT)){
  30.             Sleep(500);
  31.             if(GetAsyncKeyState(0x53)){
  32.                 ShowWindow( hWnd, SW_SHOW );
  33.             }
  34.         }
  35.                
  36.     }
  37.    
  38.     return 0;
  39. }
Add Comment
Please, Sign In to add comment