Minimize All Windows Except Yours (in Qt)

Posted on Posted in Qt Tutorials, Tutorials

You can use the little piece of magic in this post to minimize all programs and windows except yours in Qt (C++)

First add this to your .PRO (qmake project) file:

LIBS += -lOle32

Then add this to your main window header:

#include “Shldisp.h”

Finally paste this anywhere in your program to allow only your program to remain in the screen:

IShellDispatch4 *shell_disp = NULL;
HRESULT sc = CoCreateInstance( CLSID_Shell, NULL, CLSCTX_SERVER, IID_IDispatch, (LPVOID *) &shell_disp );
sc = shell_disp->ToggleDesktop();

Leave a Reply

Your email address will not be published. Required fields are marked *