例如,来自可执行文件或DLL中的CreateTimerQueueTimer回调提供的线程?具有与主线程相同的线程ID是很重要的.
procedure TMyMainClass.ExecuteMe(someparam: paramtype);
begin
{something}
end;
Run Code Online (Sandbox Code Playgroud)
和
procedure TimerCallback(pvContext: pointer; fTimerOrWaitFired: boolean); stdcall;
begin
{do what ?}
end;
Run Code Online (Sandbox Code Playgroud)
Final update:
所有这些东西(TThread.Synchronize,TThread.Queue,PostThreadMessage等)的作品通过消息.因此,请确保dll在等待回调时主机应用处理消息.
下午好:-),我有一个框架.此框架由Main Form动态创建.
主要形式:
Interface := TInterface.Create(self);
with handlingInterface do begin
Parent := Form1;
Left := 0; Top := 35;
Width := 570; Height := 250;
end;
Run Code Online (Sandbox Code Playgroud)
在Frame中我有一个Thread.我从Frame调用这个Thread.为什么我可以将Thread与Frame同步?没有:
var
Form1: TForm1;
Run Code Online (Sandbox Code Playgroud)
我在Frame中调用Thread,我想在Frame中更改ProgressBar的位置.我不知道,为什么我可以在Thread的Synchronize方法中访问ProgressBar.
如果是Form中的Thread和ProgressBar - Synchronize访问是Form1.ProgressBar ...
但我在Frame中有Thread和ProgressBar .