Windows 任务计划程序:IAction.QueryInterface() 返回错误我找不到其定义
我正在尝试使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
0x80004003 是“无效指针”错误,又名
E_POINTER
。我假设 execAction 的声明类似于:
但是,QueryInterface 需要一个指向接口指针的指针。换句话说,您传递一个存储位置来放置
IUnknown*
...,或者在本例中为IExecAction*
。因此,您需要传递
execAction
的地址,以便 QueryInterface 可以将接口指针返回给您。如:我认为这就是发生的情况,因为将指针值初始化为 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: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, aIExecAction*
.So, you need to pass the address of
execAction
so QueryInterface can return the interface pointer to you. As in: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 ofexecAction
.