That's probably what I wrote: TLabel, TButton, etc. thay are VCL objects.
I usually solve this kind of problem with creating a 'message' object and send this object to to form handle with PostMessage(), which I pass in the user parameter.
Receive the object in the form, use it and free the object.
Something like this:
BASS_ChannelSetSync(fStream, BASS_SYNC_MIDI_LYRIC, 0, @MIDILyricSync, Self.Handle); //* Self is the TForm which will receive the message
type
TCallbackMessage = class
Text: String;
end;
Const
MYMSG_BASE = WM_USER * + 100;
MYMSG_CALLBACK = MYMSG_BASE + 1;
type
TForm1...
private
procedure LyricSyncMessageArrived(var Message: TMessage); message MYMSG_CALLBACK; // Add this to the form's private section
...
procedure TForm1.LyricSyncMessageArrived(var Message: TMessage); // Add this procedure to the form
var
Data: TCallbackMessage;
begin
Data := TCallbackMessage(Message.WParam);
try
Label.Caption := Data.Text;
finally
FreeAndNil(Data);
end;
end;
procedure LyricSync(Handle : HSYNC; Stream : HSTREAM; data, user : DWORD); stdcall;
var
Mark : BASS_MIDI_MARK;
var i: integer;
Text: String;
Data: TCallbackMessage;
begin
i := 0;
while BASS_MIDI_StreamGetMark(Stream, BASS_SYNC_MIDI_LYRIC, i, Mark) do
begin
Text := concat(Text, Mark.text);
inc(i);
end;
Data := TCallbackMessage.Create;
Data.Text := Text;
PostMessage(User, MYMSG_CALLBACK, WParam(Pointer(Data)), 0);
end; {LyricSync}
When passing simple data a simple GetMem() FreeMem can be used instead of a class.