Skip to main content
gamedev.net
🔒 Locked

Callback functions

Started by MarkyD 3 replies 450+ views
Original Post
MarkyD
MarkyD
Hi again. This time, I want to know how to make my own callback functions. I know somebody else asked this in another forum, but I didn''t follow it whatsoever. Answer me and I''ll be happy again. ~ There''s no substitute for failure ~
MButchers
MButchers
Hi there,

declare your procedure type as

type
TMyCallBack = procedure(Params...);

then the function to call with the callback eg

procedure MyWrapperProc(S: String; CallBack: TMyCallBack);

then declare your procedure as

procedure MyCallback(Params...);

then all you need to do is call

MyWrapperProc(''Delphi Callback Proc'', MyCallback);


If your using callbacks from the windows API then
you need to declare them with the stdcall ie

type
TMyCallBack = procedure(Params...); stdcall;

if your using them from within a class do

type
TMyCallBack = procedure(Params...) of object;


Hope it helps

Mark.
MarkyD
MarkyD
OK, Got that.

I''ll give it a go and see what happends...

~ There''s no substitute for failure ~
MarkyD
MarkyD
Worked wonderfully.
Ta.

~ There''s no substitute for failure ~

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.