Access violation casting IDispatch in XE2

白昼怎懂夜的黑 提交于 2019-12-04 12:24:10

The 0xbaadf00d memory address is a pseudo memory address, meaning "BAD FOOD" (look at the hexa chars). This is used usually by code when you ask for invalid interfaces or calls.

What if you change the line into:

pDisp: TDispNewEnum;
...
if (Succeeded (Unknown.QueryInterface (IDispatch, pDisp))) then
begin
   _NewEnumPropFailed := False;
   try
     //property _NewEnum
     Unknown:= pDisp._NewEnum; 
...

which makes better sense to me.

I've noticed some undocumented changes in the XE2 interface binding. Perhaps the previous code with a forced typecast (TDispNewEnum(pDisp)) is not working any more because of that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!