关于 oldacc.dll的问题: AccessibleObjectFromWindow (200分)

  • 主题发起人 主题发起人 rebirth
  • 开始时间 开始时间
R

rebirth

Unregistered / Unconfirmed
GUEST, unregistred user!
if(S_OK == (hr = AccessibleObjectFromWindow(hWndMainWindow,
OBJID_WINDOW,IID_IAccessible,(void**)&paccMainWindow)))
{
???
}

转换成delphi 该怎么写呢?
参考1:
MSDN 定义 AccessibleObjectFromWindow
The AccessibleObjectFromWindow function retrieves the address of the specified interface to the object associated with the given window.
For more information about COM parameter attributes, allocating memory, and freeing memory, see Definitions of Parameter Attributes.

STDAPI AccessibleObjectFromWindow(
HWND hwnd,
DWORD dwObjectID,
REFIID riid,
void** ppvObject
);
Parameters
hwnd
[in] Specifies the handle of a window for which an object is to be retrieved. To retrieve an interface pointer to the cursor or caret object, specify NULL and use the appropriate object ID in dwObjectID.
dwObjectID
[in] Specifies the object ID. This value is one of the standard object identifier constants or a custom object ID such as OBJID_NATIVEOM, which is the object ID for the Microsoft Office native object model. For more information about OBJID_NATIVEOM, see the Remarks section in this topic.
riid
[in] Specifies the reference identifier of the requested interface. This value is either IID_IAccessible or IID_IDispatch.
ppvObject
[out] Address of a pointer variable that receives the address of the specified interface.
Return Values
If successful, returns S_OK.
If not successful, returns one of the following or another standard COM error code.
该内容在msdn的全文:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msaa/msaaccrf_2r7b.asp

参考文档2:
http://www.richsearch.com/displ.jsp?lid=1432541
 
http://www.free120.com/?user=flyingsea
 
抗议广告!谢谢提前!呵呵。
 
把这个dll从type library中导入,就是delphi代码了。
 
to soul, 是的,导入了,但是没有这个函数的相关声明啊。
有一个是 AccessibleObjectFromID 的delphi函数在tlb 里。
还定义了一些接口和类型数据。

问题还没有解决!
 
MSDN 上很清楚:
Requirements
Windows NT/2000/XP: Included in Windows 2000 and later.
Windows 95/98/Me: Included in Windows 98 and later.
Redistributable: Requires Active Accessibility 1.3 RDK on Windows NT 4.0 SP6 and Windows 95.
[blue] Header: Declared in Oleacc.h.
Library: Use Oleacc.lib.[/blue]

在VC,CB中只需要include Oleacc.lib和Oleacc.h

delphi需要转换成IDL代码:
使用project | import type library | Add
C:/WINNT/system32/Oleacc.dll
可以生成delphi代码
 
我在回复soul的时候也说了,这些我已经做了,但是还是调用失败。
这个问题我的朋友已经解决。
散分了。

问题之一:
转入的tlb不全面,没有提供 上面我需要的函数的定义。自己按照C++翻译的定义可能不准确。
问题之二:
写出后,出现内存读写错误,误以为是引入或接口调用错误。实际是定义翻译错误。
 
后退
顶部