回调函数示例

#include <iostream>
#include <Windows.h>
using namespace std;

typedef void    (CALLBACK *LPCALLBACK)( int a, int b, int c );

void WINAPI Callback( LPCALLBACK pCallback )                 
{
 pCallback(1,2,3);
}

void CALLBACK OnFun(int a, int b, int c );

int main()
{
 Callback(OnFun);
}

void CALLBACK OnFun(int a, int b, int c )
{
 cout<<a<<b<<c;
}

一般的是用户有数据,程序库有函数

回调则是用户有函数,程序库有数据

 回调函数的作用是  让内核代码 使用用户定义的函数

你可能感兴趣的:(c,callback,include,winapi)