Author Topic: SYNCPROC swapped Data and User variables?  (Read 3133 times)

3delite

  • Posts: 907
SYNCPROC swapped Data and User variables?
« on: 10 Mar '06 - 01:23 »
Ian, could you check this please? :-*

Oh I see, the callback can't be a part of a class.. :'(
« Last Edit: 10 Mar '06 - 01:59 by 3delite »

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re: SYNCPROC swapped Data and User variables?
« Reply #1 on: 10 Mar '06 - 15:34 »
Callbacks can be part of a class, but they need to be "static". I don't know how that is in Delphi, but there are several C/C++ examples, including this ancient thread...

http://un4seen.com/forum/?topic=1184

3delite

  • Posts: 907
"static" SYNCPROC in a Delphi class, how!????
« Reply #2 on: 10 Mar '06 - 20:59 »
Thanx Ian!
Well I read the thread, but no luck till now... :-\ I think about it, maybe I come up with a solution...

If somebody knows how to make a function "static" in Delphi, please don't hesitate to tell me! :-[

I found a topic, but I don't understand: Msg 6573 - method in assembly is not static - how do I make it static ?

I tried a class like this:
Code: [Select]
TMyPanelContainer = class(TPanel)
  private
    class procedure Callback(OccSync: HSYNC; Channel, Data, User: DWord); stdcall; static;
  ...

But Delphi says: Field definition not allowed after methods or properties
...and in the Delphi help: Methods are by default static.  :o  ???

EDIT: Not good. The example is for Delphi.NET but I am using Delphi7!

I have an idea tough! Could I pass a pointer to a structure in User which has the User variable I need, and another pointer to my object so I can access it's properties?

I'll try that! ;)
« Last Edit: 11 Mar '06 - 16:22 by 3delite »

3delite

  • Posts: 907
Re: SYNCPROC swapped Data and User variables?
« Reply #3 on: 12 Mar '06 - 15:51 »
Success! ;D

I daclare a reference to my class, pass the Index in User, and I can acces my array (with the help of the reference) in the class within the callback! 8)

Thank you!