VC6.0,Win10,C ++。

当我声明线程池回调函数

VOID CALLBACK ProcessHook(PTP_CALLBACK_INSTANCE instance, PVOID lParam);


我编译它并得到一个错误


  错误C2065:“ PTP_CALLBACK_INSTANCE”:未声明的标识符


我已包含Windows.h



 #include <Windows.h>
 #include <stdio.h>
 VOID CALLBACK ProcessHook(PTP_CALLBACK_INSTANCE instance, PVOID lParam);


结果

    c:\users\jasey\windows-program\keyboardhook\keyboardhook.h(33) :
    error C2065: 'PTP_CALLBACK_INSTANCE' : undeclared identifier
    c:\users\jasey\windows-program\keyboardhook\keyboardhook.h(33) :
    error C2146: syntax error : missing ')' before identifier 'instance'
    c:\users\jasey\windows-program\keyboardhook\keyboardhook.h(33) : warning C4229: anachronism used : modifiers on data are ignored

最佳答案

您可以从here下载Windows SDK,然后安装或安装via Visual Studio

从WiKi:


  windows.h是C和C ++编程语言的Windows特定头文件,其中包含所有
  Windows API中的所有函数,Windows使用的所有常见宏
  程序员,以及各种函数使用的所有数据类型和
  子系统。


如果安装了17134的SDK版本,则可以在以下路径下找到它:C:\ Program Files(x86)\ Windows Kits \ 10 \ Include \ 10.0.17134.0 \ um。

在此,SDK代表Windows软件开发套件。安装后,例如,您将在控制面板\程序\程序和功能中看到“ Windows软件开发工具包-Windows 10.0.17134.12”。

Windows SDK提供了头文件(如windows.h),库和工具来帮助您开发Windows应用程序。

关于c++ - Windows线程池“PTP_CALLBACK_INSTANCE”:未声明的标识符,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54033221/

10-11 03:35