왜 그런 걸까요


#include <Windows.h>

#include<stack>

#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_CONTROL) < 0)

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

    }

}