C语言调用 COM 的问题
把DLL 转IDL 在弄成.H .C但是使用时候报错,不知道怎么回事。
请高手指导。。
这是在VC下的一段代码:
#include <windows.h>
#include <objbase.h>
#include <wininet.h>
#include <Shlobj.h>
………………
TCHAR wszWallpaper[MAX_PATH];
HRESULT hr;
IActiveDesktop *pIAD;
CoInitialize ( NULL );
hr = CoCreateInstance((REFCLSID)&CLSID_ActiveDesktop,
NULL,CLSCTX_INPROC_SERVER,(REFIID)&IID_IActiveDesktop,(LPVOID *)&pIAD );
if ( SUCCEEDED(hr) )
{
hr=pIAD->GetWallpaper (wszWallpaper, MAX_PATH, 0 );
if ( SUCCEEDED(hr) )
{
MessageBox(hwnd,wszWallpaper,"",MB_OK);
}
pIAD->Release();
}
CoUninitialize();
下面是错误提示:
E:\C FLIES\vc_comtest_c\profile_comtest.c(135) : error C2039: 'GetWallpaper' : is not a member of 'IActiveDesktop'
c:\program files\microsoft visual studio\vc98\include\shlobj.h(2975) : see declaration of 'IActiveDesktop'
E:\C FLIES\vc_comtest_c\profile_comtest.c(140) : error C2039: 'Release' : is not a member of 'IActiveDesktop'
c:\program files\microsoft visual studio\vc98\include\shlobj.h(2975) : see declaration of 'IActiveDesktop'