将UIAutomation提供程序添加到Delphi控件(特别是网格)中 [英] Adding UIAutomation Providers to Delphi controls (specifically grids)

查看:206
本文介绍了将UIAutomation提供程序添加到Delphi控件(特别是网格)中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的VCL Delphi应用程序具有许多需要通过UIAutomation进行交互的网格.有很多问题,尤其是TStringGrid没有实现任何IUIAutomation模式(IGridProvider或ITableProvider,或者甚至是IValueProvider).

Our VCL Delphi application has a number of grids that we need to start to interact with via UIAutomation. There are a number of issues, not least that the TStringGrid doesn't implement any of the IUIAutomation patterns (IGridProvider or ITableProvider, or for that matter even IValueProvider).

我试图找出我需要添加到TStringGrid以便允许其实现提供程序(在.NET的System.Windows.Automation.Provider命名空间中)的程序.

I am trying to find out what I need to added to a TStringGrid to allow it to implement the providers (which in the System.Windows.Automation.Provider namespace in .NET).

推荐答案

尽管我无法提供实现您在 TStringGrid 上所需的自动化功能所需的特定步骤,但我可以根据评论说您几乎拥有了所需的一切.

Although I cannot provide the specific steps required to implement the automation capabilities you require on TStringGrid, I can say that based on the comments you have almost everything you need.

您找到的文章描述了对Win32非托管代码的UI自动化支持的基本实现很好的起点.

The article you found describing the basic implementation of UI Automation support for Win32 Unmanaged code is a good place to start.

有关通过 UIAutomationCore.DLL 中的IDL公开和不公开的问题,可以通过以下事实解决:所讨论的DLL本身旨在由非托管代码使用.它本身不包含托管代码.至少不涉及非托管用例.

The questions over what is and is not exposed through the IDL in UIAutomationCore.DLL are then addressed by the fact that the DLL in question is itself intended to be consumed by unmanaged code. It contains no managed code itself. At least not that is involved in an unmanaged use case.

包含的内容是IDL描述的COM接口,但也包含一些由DLL导出的简单功能.据我所知,IDL没有描述DLL的导出表.即使能够这样做,但对于此DLL,它却不能(至少并非在所有情况下).

What is does contain is a COM interface described by IDL, but also some functions simply exported by the DLL. As far as I know, IDL does not describe the exports table of a DLL. Even if it is capable of doing so, in the case of this DLL it does not (at least not in all cases).

例如,您提到的 UiaHostProviderFromHwnd()函数是一个简单的DLL导出.

For example, the UiaHostProviderFromHwnd() function that you have mentioned is a simple DLL export. Some of the additional functions exported in this way are described in this MSDN blog post describing creating a .net interop interface for this library. In that article they are called "flat API methods".

使用 PE资源管理器,我可以看到 UIAutomationCore.dll导出的81个此类函数库.

不幸的是,DLL导出表不描述任何导出函数的参数或返回类型,仅描述名称.因此,除了类型库(由IDL生成)之外,您还需要找到并转换 UIAutomationCore.h header 文件以用于Delphi(即Pascal)

Unfortunately a DLL exports table does not describe the parameters or return types of any exported function, only the names. So, in addition to the type library (produced from the IDL) you will also need to locate and convert the UIAutomationCore.h header file for use with Delphi (i.e. Pascal).

然后,您应该具有为所需的任何VCL控件实现UI自动化功能所需的一切.

You should then have everything need to implement the UI Automation capabilities for any VCL control you desire.

这篇关于将UIAutomation提供程序添加到Delphi控件(特别是网格)中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆