如何修复"WINAPI事件未声明标识符"?错误. [英] How to fix "WINAPI event undeclared identifiers" error.

查看:500
本文介绍了如何修复"WINAPI事件未声明标识符"?错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下WINAPI函数.

Hi, I have the following WINAPI function.

#include <windows.h>
#include <winwlx.h>

int WINAPI WlxLoggedOnSAS(PVOID pWlxContext,DWORD dwSasType,PVOID pReserved)
{
if (dwSasType == WLX_SAS_TYPE_CTRL_ALT_DEL)
{
// Add additional code of you own
::MessageBox(HWND_DESKTOP,"Unable to LoggOff!","help",MB_OK);
return WLX_SAS_ACTION_NONE;
}
else return GWlxLoggedOnSAS( pWlxContext, dwSasType, pReserved );
}


构建时,我得到了未声明的标识符 GWlxLoggedOnSAS

注意:GWlxLoggedOnSAS与WilxLoggedOnSAS不同.

另外,我不确定这是否是它的称呼方式,


When I build I get undeclared identifier GWlxLoggedOnSAS

Note: GWlxLoggedOnSAS is different from WilxLoggedOnSAS.

Also, I am not sure if this is the way to call it,

while (1==1) { CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)&WlxLoggedOnSAS, 0, 0, NULL); }



在此先感谢...



Thanks in advance...

推荐答案

与CreateThread一起使用的函数只能有一个void *参数;请参见 ThreadProc回调函数 [ ^ ].要使用其他参数,您必须像这样构造一个结构:
The function you use with CreateThread can have only a void * argument; see MSDN docs on a ThreadProc Callback Function[^]. To use your other arguments, you''d have to make a struct like so;
struct
{
    PVOID pWlxContext;
    DWORD dwSasType;
    PVOID pReserved;
}threadparams;



并将指向它的指针传递给CreateThread:



and pass a pointer to that to CreateThread:

CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)&WlxLoggedOnSAS, (void*)&threadparams, 0, NULL);



并像这样接收它:



And receive it like so:

DWORD WINAPI WlxLoggedOnSAS(void *threadparams)
{
    struct
    {
        PVOID pWlxContext;
        DWORD dwSasType;
        PVOID pReserved;
    }*tp = threadparams;

    // Rest of your function goes here



如果您认为该结构在调用函数之前是静态的,那么您会认为WlxLoggedOnSAS线程在使用它们完成操作之前会被作用域破坏.



You might want to make the struct static in your calling function if you think it will be destroyed by scope before the WlxLoggedOnSAS thread is done with them.


GWlxLoggedOnSAS怎么定义?
有人告诉我,此功能仅在Windows XP之前有效,不适用于VISTA或7.
真的吗?如何为VISTA和7定义?
what about GWlxLoggedOnSAS, how to define it?
I was told that this function is only good until Windows XP, not for VISTA or 7.
Is that true? How to define for VISTA and 7?


您需要声明GWlxLoggedOnSAS的头文件.据我了解,它不是GINA.DLL导出的功能之一.
:)
You need the header file declaring the GWlxLoggedOnSAS. As far as I know it isn''t one of the functions exported by the GINA.DLL.
:)


这篇关于如何修复"WINAPI事件未声明标识符"?错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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