如何使用Wlanregisternotification函数

How to use WlanRegisterNotification function

本文关键字:函数 Wlanregisternotification 何使用      更新时间:2023-10-16

我想注册WLAN通知。

代码:

HANDLE hClient;
DWORD dwResult = 0;
DWORD dwPrevNotif = 0;
dwResult = WlanRegisterNotification(hClient, WLAN_NOTIFICATION_SOURCE_ALL, TRUE, NotificationCallback, NULL, NULL, &dwPrevNotif);
void WINAPI WirelessConnect::NotificationCallback(PWLAN_NOTIFICATION_DATA wlanData, PVOID context)
{
}

问题是:

error: C3867: 'WirelessConnect::NotificationCallback': non-standard syntax; use '&' to create a pointer to member

当我使用&NotificationCallback时,我会出现错误:

error: C2276: '&': illegal operation on bound member function expression

如何修复它?谢谢。

您试图将指针传递给成员函数作为回调,即 - 作为功能指针。您不应该这样做,如果没有对象本身,成员函数指针是毫无意义的。

您应该使回调成为静态功能,这样就不涉及对象。