Windows 任务计划程序:IAction.QueryInterface() 返回错误我找不到其定义

发布于 2024-10-11 10:18:24 字数 722 浏览 3 评论 0原文

我正在尝试使用 C++ win32 安排任务(在特定时间打开 .exe)。但在一个特定的点上,我收到了一个错误,我已经搜索了 &搜索并尝试找到这个错误的定义但我找不到它?

你知道这个错误是什么意思吗:十六进制:80004003 十进制:2147500035

我不会发布整个函数,因为它相当长(除非您可能需要它来确定错误上下文?)。 em>

我正在使用的代码(导致错误)如下:

//  QI for the executable task pointer.
hr = action -> QueryInterface( IID_IExecAction, (void**) execAction );
action -> Release();

if( FAILED(hr) )
{
    printf("QueryInterface call failed for IExecAction: %x %X %u \n", hr, hr, hr );
    rootFolder -> Release();
    task -> Release();
    CoUninitialize();
    return false;
}

输出为:IExecAction 的 QueryInterface 调用失败:80004003 80004003 2147500035

I am attempting to schedule a task (to open an .exe at a specific time) using C++ win32. But at one specific point I am getting an error, I have searched & searched to try & find the definition of this error but I cannot find it?

Do you know what this error means: Hexadecimal: 80004003 Decimal: 2147500035

I wont post the whole function because its rather long (unless you may need it to determine the error context?).

The code I am using (that causes the error) is the following:

//  QI for the executable task pointer.
hr = action -> QueryInterface( IID_IExecAction, (void**) execAction );
action -> Release();

if( FAILED(hr) )
{
    printf("QueryInterface call failed for IExecAction: %x %X %u \n", hr, hr, hr );
    rootFolder -> Release();
    task -> Release();
    CoUninitialize();
    return false;
}

The output is: QueryInterface call failed for IExecAction: 80004003 80004003 2147500035

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

御守 2024-10-18 10:18:24

0x80004003 是“无效指针”错误,又名 E_POINTER

我假设 execAction 的声明类似于:

IExecAction* execAction = NULL;

但是,QueryInterface 需要一个指向接口指针的指针。换句话说,您传递一个存储位置来放置 IUnknown*...,或者在本例中为 IExecAction*

因此,您需要传递 execAction地址,以便 QueryInterface 可以将接口指针返回给您。如:

hr = action -> QueryInterface( IID_IExecAction, (void**) &execAction );

我认为这就是发生的情况,因为将指针值初始化为 NULL 是一种常见的编码实践,并且 QueryInterface 已记录,以在第二个参数为 NULL 时返回 E_POINTER。如果没有,请使用 execAction 声明更新您的问题。

0x80004003 is an "invalid pointer" error, a.k.a. E_POINTER.

I assume the declaration of execAction is something like:

IExecAction* execAction = NULL;

But, QueryInterface expects a pointer to an interface pointer. In other words, you pass a storage location in which to place an IUnknown*... or, in this specific case, a IExecAction*.

So, you need to pass the address of execAction so QueryInterface can return the interface pointer to you. As in:

hr = action -> QueryInterface( IID_IExecAction, (void**) &execAction );

I assume this is what's happening since initializing pointer values to NULL is a common coding practice, and QueryInterface is documented to return E_POINTER when the second argument is NULL. If not, please update your question with the declaration of execAction.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文