现在的位置: 首页 > 综合 > 正文

关于CallBack函数

2013年10月24日 ⁄ 综合 ⁄ 共 503字 ⁄ 字号 评论关闭

CallBack函数要声明为全局函数(C语言中常用),或者是类的static成员函数(OO的方式)。以便避免this指针的影响。
还不是很明白什么时候要这么用。有些windows API 要求把指向callback函数的指针作为传入参数。
BOOL LineDDA(
  int
nXStart,             // x-coordinate of line's starting point
  int nYStart,             // y-coordinate of line's starting point
  int nXEnd,               // x-coordinate of line's ending point
  int nYEnd,               // y-coordinate of line's ending point
  LINEDDAPROC lpLineFunc// pointer to callback function
  LPARAM lpData            // pointer to application-defined data
);

现在就知道这种情况会用到,希望以后能真正深刻理解到底是怎么回事。

抱歉!评论已关闭.