【Demo 0040】显示桌面功能

通过读取Shell 中接口(IID_IShellDispatch), 使用此方式MinizeAll() 来最小化窗体, 并通过UndoMinizeAll()来恢复。

这个功能比起Window提供的[显示桌面]来, 功能还是有局限性的,此方法仅用于所有顶层窗体不存在模态对话框时才起作用。

一、关键代码块

IShellDispatch    *pDispatch;
CoInitialize(NULL);
if (CoCreateInstance(CLSID_Shell, NULL, CLSCTX_INPROC, IID_IShellDispatch, (void **)&pDispatch) == S_OK)
{
    pDispatch->MinimizeAll();
    pDispatch->Release();
}
CoUninitialize();

 

演示代码

posted @ 2011-08-31 23:20  zTercel  阅读(236)  评论(0)    收藏  举报