(C++/win32) Hide a window so that the user cannot alt-tab or switch to it

牧云@^-^@ 提交于 2019-12-12 21:18:52

问题


I'm currently using ShowWindow( hwnd, SW_HIDE ), but AltTab still seems to be able to switch to it after it's hidden.

Is there a way to completely hide a window without destroying it?

EDIT: I should add that using the WS_EX_TOOLBOX style doesn't help. With enough AltTab and ShowWindow(SW_SHOW), some strange things happen.


回答1:


Try this code to hide window
I have try this code and hidden window will be not appear while you pressing Alt + Tab [ I am using win-xp]
To show window press Tab + Esc

HWND hwnd_win = GetForegroundWindow();
ShowWindow(hwnd_win,SW_HIDE);
while(1)
{
    Sleep(1000);
    if(GetAsyncKeyState(VK_ESCAPE|VK_TAB ))
        break;
}   
ShowWindow(hwnd_win,SW_SHOW);


来源:https://stackoverflow.com/questions/11381548/c-win32-hide-a-window-so-that-the-user-cannot-alt-tab-or-switch-to-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!