今天在DELPHI上随便编写了个回调函数的例子,怕以后忘了,赶紧给它给记下来,呵呵。
觉的好简单,什么都没有,只是在同一个单元内,利用了DELPHI的多线程调用回调函数,高手别见笑哈!下次肯
定要多加点东西完善滴,这次只是熟悉一下实现回调的整个过程。
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
ListBox1: TListBox;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type PFCALLBACK = function(Param1:integer;Param2:integer):integer;stdcall;
// 定义回调函数的类型
var
Form1: TForm1;
gCallBack:PFCALLBACK;
function CBFunc(Param1:integer;Param2:integer):integer;s

这篇博客介绍了如何在 Delphi 中使用回调函数,通过一个简单的多线程例子展示了回调函数的应用。作者强调了回调函数类型定义、全局函数定义以及在多线程中的使用方法。读者将了解到回调函数在 Delphi 中的实现过程。
最低0.47元/天 解锁文章
390

被折叠的 条评论
为什么被折叠?



