For example from thread provided by callback from CreateTimerQueueTimer in executable or dll? It is significant to have same thread id as main thread.
procedure TMyMainClass.ExecuteMe(someparam: paramtype);
begin
{something}
end;
and
procedure TimerCallback(pvContext: pointer; fTimerOrWaitFired: boolean); stdcall;
begin
{do what ?}
end;
Final update:
All this stuff (TThread.Synchronize
, TThread.Queue
, PostThreadMessage
etc) works through messages. So be sure host application of your dll
processing messages while waiting for callback.