c++ - Iaccessible接口(interface)的accLoacation()方法中的参数如何初始化?

标签 c++ com

我尝试使用 Iaccessible 接口(interface)的 accLocation() 方法检索元素的屏幕位置,但无法启动该方法的参数

IAccessible *plocation;
long *x;
long *y;
long *width;
long *height;

VARIANT varChild;
varChild.vt = VT_I4;
varChild.iVal = CHILDID_SELF;

hr = pIaccessible->GetIAccessible(&plocation);
hr = plocation->accLocation(x, y, width, height, varChild);

但是当我运行它时,错误信息如下:

    uninitialized local variable 'x'used,
    uninitialized local variable 'y'used,
    uninitialized local variable 'width'used,
    uninitialized local variable 'height'used

最佳答案

我有一种感觉,你需要使用:

long x;
long y;
long width;
long height;

...

// Pass the addresses of objects where the values can be stored.
hr = plocation->accLocation(&x, &y, &width, &height, varChild);

关于c++ - Iaccessible接口(interface)的accLoacation()方法中的参数如何初始化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57599319/

相关文章:

c++ - 'bool' 是 C++ 中的基本数据类型吗?

c++ - 如何从非托管 COM dll 生成类型库

multithreading - FreeThreadedDOMDocument,Neutral Apartments和Free-threaded Marshaler

c++ - 如何从本地目录加载 C++ 中的图像

c++ - 使用 GLUT_DOUBLE 模式绘制形状

android - 如何在不同 cpps 中创建的节点之间进行交互...?

com - 注册的 COM 类的最大长度是多少?

c# - 获取书签处的文本

.net - 如何从 Delphi Win32 应用程序访问 .Net Web 服务?

C++ Sfml 文本输出