我想将 COM 方法作为函数参数传递,但出现此错误(Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86):
错误 C3867:“IDispatch::GetTypeInfoCount”:函数调用缺少参数列表;使用 '&IDispatch::GetTypeInfoCount' 创建指向成员的指针
我错过了什么?
非常感谢你。
#include <atlbase.h>
void update( HRESULT(*com_uint_getter)(UINT*), UINT& u )
{
UINT tmp;
if ( S_OK == com_uint_getter( &tmp ) ) {
u = tmp;
}
}
// only for compile purpose, it will not work at runtime
int main(int, char*[])
{
// I choose IDispatch::GetTypeInfoCount just for the sake of exemplification
CComPtr< IDispatch > ptr;
UINT u;
update( ptr->GetTypeInfoCount, u );
return 0;
}