函数WlanRegisterNotification不编译 [英] The function WlanRegisterNotification dont compile

查看:309
本文介绍了函数WlanRegisterNotification不编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在Windows XP SP3上使用Visual C ++ 2008 Express Edition,我写了这段代码:
$

Hi all,

I've Visual C++ 2008 Express Edition on Windows XP SP3, and I write this code:

#include <iostream>
#include <string>
#include <windows.h>

// headers needed to use WLAN APIs

#include <wlanapi.h>


// Application defined callback function

VOID NotificationCallback(
    PWLAN_NOTIFICATION_DATA pNotifData, 
    PVOID pContext
    )
{
  std::cout <<" -- NotificationCallback -- " <<std::endl;
  return;
}


int main()
{
  DWORD rtn;
  DWORD dNegotiatedVersion;
  HANDLE hClientHandle;

  dNegotiatedVersion = 0;

  rtn = WlanOpenHandle(
    WLAN_API_VERSION,
    NULL,
    &dNegotiatedVersion,
    &hClientHandle
  );

  if(rtn != ERROR_SUCCESS)
  {
    std::cerr <<"Error occured in WlanOpenHandle" <<std::endl;
    return -1;
  }

  WlanRegisterNotification(
    hClientHandle,
    WLAN_NOTIFICATION_SOURCE_ALL,
    FALSE,
    NotificationCallback,
    NULL,
    NULL,
    NULL
  );

  WlanCloseHandle(hClientHandle, NULL);

  return 0;
} // end of function main



但是当我编译时我有这个错误:

错误C2664: 'WlanRegisterNotification':无法将参数4从'void(__ cdecl *)(PWLAN_NOTIFICATION_DATA,PVOID)'转换为'WLAN_NOTIFICATION_CALLBACK'

什么错了?任何人都可以帮助我?
Thanx。


But when I compile I have this error:

error C2664: 'WlanRegisterNotification' : cannot convert parameter 4 from 'void (__cdecl*)(PWLAN_NOTIFICATION_DATA,PVOID)' to 'WLAN_NOTIFICATION_CALLBACK'

What's wrong? Anybody can help me?
Thanx.

推荐答案

尝试修改你的原型以包含WINAPI
用于VOID WINAPI NotificationCallback (
PWLAN_NOTIFICATION_DATA pNotifData,
PVOID pContext
Try hange your prototype to include WINAPI

VOID WINAPI NotificationCallback(
    PWLAN_NOTIFICATION_DATA pNotifData,
    PVOID pContext
    )


这篇关于函数WlanRegisterNotification不编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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