描述:
各位大虾,小生初用ATL,出现一个问题,描述如下,希指正。
小生的控件有一个PLAY方法。定义如下:
Play方法的IDL描述如下:
[id(2), helpstring("method Play")] HRESULT Play();
Play方法的实现如下:
STDMETHOD(Play)();//declaration
STDMETHODIMP COneArmedBandit::Play()//definition
{
.....
}
VTBL描述如下:
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Play( void) = 0;
PLAY方法的调用:
Play方法的Invokehelper描述:
void COneArmedBandit::Play()
{
InvokeHelper(0x2, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
调用时,采取如下方法:
先声明一个COnearmedbandit类型的变量m_bandit
然后直接调PLAY方法:m_bandit.Play();
运行时出错画面如下示:
Debug Error!
Program :d:\...\TestCtrl.exe
Module:
File:i386\chkesp.c
Line:42
The value of ESP was nto properly saved access a function call.This is usually a result of calling a function daclared with one calling convetion with a function pointer declared with one different calling convetion.
按下忽略后,出现OLEAUT32。dll报错,OXC0000005
敬请回答!!