DELPHI中回调函数的使用[3]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 haitianwjl 的 blog

thdfunction= function(i:integer;s:string):integer; stdcall;

 

对于过程的声明:

type

   thdprocedure=procedure(s:string); stdcall;

2、               然后根据此原形定义一个相应的函数或过程,对于这个函数或过程来说名字没有什么要求,对函数其参数的类型和返回值的类型必须和定义的回调函数类型完全一致,对于过程来说,只需要其参数类型一样就可以了。

例:根据上面的函数和过程的原形定义一个相应的函数和一个相应的过程。

函数原形定义:

function hdfunexample(k:integer,sexam:string):integer; stdcall;

过程定义:

procedure hdproexample(sexam:string);stdcall;

3、               在程序中实现此回调函数或着过程;

function hdfunexample(k:integer,sexam:string):integer; stdcall;

begin

 

end;

 

procedure hdproexample(sexam:string);stdcall;

begin

 

end;

本文关键:回调函数,windows API
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top