Alistair George wrote:
> 
> Thanks Nic, but thats not what I meant (unless the late nights and early
> mornings are burning me out).
> The example is a Windows API call, in fact it is as follows:
> capSetCallbackOnFrame(hwnd, fpProc);
> Where fpProc is the callback proc.
> So what I need to do is write a callback function and correctly reference it
> by fpProc,
> but I know neither how to declare or get access from the capsetcall......
> capSetCallbackOnFrame(hwnd,???);
> > function beeper : boolean;
> > begin
> >   return myMainFormVar.beeper;
> > end;
> 


OK, something like:

Type TMyClass = class
  procedure mycallback;
end;

var
  myclass : TMyClass;

implementation

procedure TMyClass.myCallBack;
begin
  //do whatever - you need to add params no doubt.
end;

procedure CallBack;stdcall;
begin
  myClass.myCallBack; //just throw it into the object for more
processing
//you could do it all here, tho....
end;

procedure setItUp;
begin
  capSetCallbackOnFrame(application.handle, @CallBack);
//application.handle is a guess. a hWnd could be anything....
end;

initilization
  myClass := TMyClass.Create;
end.

I suppose my point is, you CAN NOT just do a call back into a method. It
doesn't work, as the method expects the stack to look something like:

ParamN
....
Param1
Pointer_To_Self

and a procedure is:

ParamN
...
Param1

(ie, no reference to the object)

and windows can't - and will not - add the reference to the object.

HTH.

N
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to