Advertisement
Guest User

Untitled

a guest
Nov 15th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <windows.h>
  4. #include <thread>
  5.  
  6. using namespace std;
  7. HWND hwnd;
  8. void asf_thread() {
  9.     system("ASF.exe > nul");
  10. }
  11.  
  12. int a=0;
  13. void window_thread(){
  14.  
  15.     while(1){
  16.     if(RegisterHotKey( NULL, 1000, MOD_SHIFT, 'b')){
  17.             if(a==0){
  18.                 hwnd = GetForegroundWindow(); // get handle of currently active window
  19.                 cout<<"dziala";
  20.                 ShowWindow( hwnd, SW_HIDE );
  21.                 a=1;
  22.             }
  23.             if(a==1){
  24.                 hwnd = GetForegroundWindow(); // get handle of currently active window
  25.                 cout<<"dziala";
  26.                 ShowWindow( hwnd, SW_SHOW );
  27.                 a=0;
  28.             }
  29.         }
  30.     }
  31. }
  32.  
  33. int main()
  34. {
  35.     thread t2(window_thread);
  36.     thread t1(asf_thread);
  37.  
  38.     t2.join();
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement