65,211
社区成员
发帖
与我相关
我的任务
分享
#include "stdafx.h"
#include "iostream"
using namespace std;
#include <atlconv.h>
#include <wininet.h> // definisce alcuni flag usati da ActiveDesktop e ShellLink
#include <shlobj.h> // definizioni principali per l'uso di ActiveDesktop e ShellLink
//struct __declspec(uuid("F490EB00-1240-11D1-9888-006097DEACF9")) IActiveDesktop;
int main(int argc, char* argv[])
{
IActiveDesktop * pIAD = NULL;
WCHAR wszWallpaper[ MAX_PATH ] = { 0 };
CoInitialize ( NULL );
HRESULT hr = CoCreateInstance ( CLSID_ActiveDesktop,
NULL,
CLSCTX_INPROC_SERVER,
IID_IActiveDesktop,
(void**) &pIAD );
if ( SUCCEEDED(hr) )
{
hr = pIAD->GetWallpaper ( wszWallpaper, MAX_PATH, 0 );
if ( SUCCEEDED(hr) )
wcout << L"Wallpaper path is:\n " << wszWallpaper << endl << endl;
else
cout << _T("GetWallpaper() failed.") << endl << endl;
pIAD->Release();
}
else
cout << _T("CoCreateInstance() failed.") << endl << endl;
CoUninitialize();
return 0;
}