#include <windows.h>
#include <shldisp.h>
int main ()
{
CoInitialize (0);
IShellDispatch4 *pdisp = NULL;
CoCreateInstance(CLSID_Shell, NULL, CLSCTX_ALL, __uuidof (IShellDispatch4), (void**)&pdisp);
pdisp->ToggleDesktop (); //這句是用來切換桌面的
pdisp->Release();
CoUninitialize();
};
注意這個 IShellDispatch4接口只有WINDOWS XP以上的操作系統才支持。要求shell32.dll 5.0及以上版本
#include <shldisp.h>
int main ()
{
CoInitialize (0);
IShellDispatch4 *pdisp = NULL;
CoCreateInstance(CLSID_Shell, NULL, CLSCTX_ALL, __uuidof (IShellDispatch4), (void**)&pdisp);
pdisp->ToggleDesktop (); //這句是用來切換桌面的
pdisp->Release();
CoUninitialize();
};
注意這個 IShellDispatch4接口只有WINDOWS XP以上的操作系統才支持。要求shell32.dll 5.0及以上版本
按下WIN+D鍵
keybd_event(VK_LWIN,0,0,0);
keybd_event('D',0,0,0);
keybd_event(VK_LWIN,0,KEYEVENTF_KEYUP,0);
keybd_event('D',0,KEYEVENTF_KEYUP,0);
REM This is a batch file for showing desktop
echo [Shell] > test.scf
echo Command=2 >> test.scf
echo [Taskbar] >> test.scf
echo Command=ToggleDesktop >> test.scf
test.scf
del test.scf
http://www.blogcn.com/user72/dosbar/blog/29391879.html
IShellDispatch4 *pdisp = NULL;
CoCreateInstance(CLSID_Shell, NULL, CLSCTX_ALL, __uuidof (IShellDispatch4), (void**)&pdisp);
pdisp->MinimizeAll();
//pdisp->ToggleDesktop ();
pdisp->Release();
CoUninitialize();