Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <windows.h>
- #include <thread>
- using namespace std;
- HWND hwnd;
- void asf_thread() {
- system("ASF.exe > nul");
- }
- int a=0;
- void window_thread(){
- while(1){
- if(RegisterHotKey( NULL, 1000, MOD_SHIFT, 'b')){
- if(a==0){
- hwnd = GetForegroundWindow(); // get handle of currently active window
- cout<<"dziala";
- ShowWindow( hwnd, SW_HIDE );
- a=1;
- }
- if(a==1){
- hwnd = GetForegroundWindow(); // get handle of currently active window
- cout<<"dziala";
- ShowWindow( hwnd, SW_SHOW );
- a=0;
- }
- }
- }
- }
- int main()
- {
- thread t2(window_thread);
- thread t1(asf_thread);
- t2.join();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement