Skip to content

Instantly share code, notes, and snippets.

@yanwei07
Created April 10, 2019 07:55
Show Gist options
  • Save yanwei07/68e12dac9bf14264ef8f42a8e40a49c3 to your computer and use it in GitHub Desktop.
Save yanwei07/68e12dac9bf14264ef8f42a8e40a49c3 to your computer and use it in GitHub Desktop.
#include <windows.h>
#include <shlobj.h>
#include <exdisp.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int iCmdShow)
{
// Initialize the use of COM objects...
CoInitialize(NULL);
// Create a Shell object pointer...
IShellDispatch* pShell = NULL;
HRESULT hr = CoCreateInstance(CLSID_Shell, NULL, CLSCTX_SERVER, IID_IDispatch, (void**)&pShell);
if (SUCCEEDED(hr))
{
// Call the MinimizeAll() shell function...
pShell->MinimizeAll();
// Release the COM object when we're finished...
pShell->Release();
}
CoUninitialize();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment