I'm looking for a way to intercept the ShowDesktop event and set my window at front. Is there a way doing it without using API hooks? Thanks, Omer.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
If you're writing a Windows taskbar style dock then simply make sure your window has WS_EX_TOPMOST
set and 'Show Desktop' will leave it alone. Alternatively use SetWindowPos
to make it the top-most window after it has been created, e.g.:
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
Update: You need to use the Windows Application Bar API to make a 'dock' style app. See here for more details.
Application bars also need to be removed from the top-level list displayed when you Alt+Tab etc, which can be done by adding the WS_EX_TOOLWINDOW
and removing WS_EX_APPWINDOW
.
I should of made this clear earlier, apologies.