IActiveDesktop 我在win2000下有代码:IActiveDesktop* pIAD; msdn提示IActiveDesktop“Declared in shlobj.h”,可是我无论是否添加#include "shlobj.h"都有出错信息说IActiveDesktop没有定义,这是为什么? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 In order to access Win2000 specific APIs etc, one needs the following #define in the application's stdafx.h (before any other #includes) #define _WIN32_WINNT 0x0500 有没有Shell32.dll?#include <shlobj.h>#include <comdef.h> Step 1:Add head files in stdafx.h like this:...#include <afxwin.h> // MFC core and standard components#include <afxext.h> // MFC extensions#include "wininet.h" //you should Add #include <afxdisp.h> // MFC Automation classes#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls#ifndef _AFX_NO_AFXCMN_SUPPORT#include <afxcmn.h> // MFC support for Windows Common Controls#endif // _AFX_NO_AFXCMN_SUPPORT#include <afxconv.h> //you should Add ...Step 2:#include "Shlobj.h"HRESULT hr;USES_CONVERSION;IActiveDesktop *pActiveDesktop;hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,IID_IActiveDesktop, (void**)&pActiveDesktop);if(hr==S_OK){LPCWSTR m_ActiveWallpaper=T2W(m_wallpaper);hr=pActiveDesktop->SetWallpaper(m_ActiveWallpaper,NULL);if(hr==S_OK)pActiveDesktop->ApplyChanges(AD_APPLY_ALL);pActiveDesktop->Release();} 在StdAfx.中#include <afxwin.h>之前添加如下语句:#include <afx.h>#include <wininet.h> 即可。 在http服务器下载文件 注册多个窗口类 ESMTP协议相关 相同的程序为什么在Windows2000 Server下与Windows XP下用ROSE PURIFY测试,内存泄漏会有那么大差别??? 想做一个类似于VSS的系统,该从那入手,请指一条路。 MFC那么多东西,怎么能记得住? 200分求如何对datagrid实现插入、修改、删除? 怎样在MDI中做出类似Tencent Explorer的界面?就是用一个TabCtrl控制页面显示。 COM基本问题 VC编写OPC客户端与PLC的通信程序运行2小时后即通信不了 一共就34分了,全给出了.高手指教啊. 求救,急急急!!!!!!!
#define _WIN32_WINNT 0x0500
#include <shlobj.h>
#include <comdef.h>
Add head files in stdafx.h like this:
...
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include "wininet.h" //you should Add
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT#include <afxconv.h> //you should Add
...Step 2:
#include "Shlobj.h"
HRESULT hr;
USES_CONVERSION;
IActiveDesktop *pActiveDesktop;hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,
IID_IActiveDesktop, (void**)&pActiveDesktop);
if(hr==S_OK){
LPCWSTR m_ActiveWallpaper=T2W(m_wallpaper);
hr=pActiveDesktop->SetWallpaper(m_ActiveWallpaper,NULL);
if(hr==S_OK)pActiveDesktop->ApplyChanges(AD_APPLY_ALL);
pActiveDesktop->Release();
}