ESC = 종료

F1 = 숨겨진 창 보이기

F2 = 창 숨기기


여기까지 됐는데요

추가로 음소거도 넣고 싶은데 어떻게 안될까요


#include <Windows.h>

#include<stack>

#include<string>

#include <iostream>


using namespace std;


void HideWindow();

void ShowWindow();

stack<HWND> st = {};


char c;


int main()

{

ShowWindow(GetConsoleWindow(), SW_SHOW);

while(1)

{

if (GetKeyState(VK_ESCAPE) < 0)

{

ShowWindow();

ShowWindow(GetConsoleWindow(), SW_SHOW);

break;

}

if (GetAsyncKeyState(VK_F1)&0x0001)

ShowWindow();


if(GetAsyncKeyState(VK_F2)&0x0001)

HideWindow();

}

}


bool func(char* a)

{

return strcmp(a, "Shell_TrayWnd")&& strcmp(a, "Progman");

}


void HideWindow()

{

HWND hWnd;

POINT point;

PTITLEBARINFO pti={};


GetCursorPos(&point);

hWnd = WindowFromPoint(point);


char clsName_v[256]; HWND parent = GetParent(hWnd), parent2;

while (1) {

parent2 = GetParent(parent);

if (parent2 == 0)

break;

parent = parent2;

}


if (parent != 0)

hWnd = parent;

GetClassNameA(hWnd, clsName_v, 256);

std::cout << hWnd << "\n";

std::cout << clsName_v << "\n";

if (func(clsName_v))

{

st.push(hWnd);

ShowWindow(hWnd, SW_HIDE);

}

}


void ShowWindow()

{

while (!st.empty())

{

ShowWindow(st.top(), SW_SHOW);

st.pop();

}

}