보다시피 

ESC = 종료

F1 = 숨겨진 창 모두 되돌리기

F2 = 창 숨기기인데


창마다 음소거를 하는 방법을 모르겠습니다.

코파일럿이랑 챗 gpt한테 물어봐도 어렵다고만 나와서 혹시 안 되는 건가 싶어 질문 드려봅니다


#include <Windows.h>

#include<stack>

#include <iostream>

#include <conio.h>


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;


    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();

    }

}