Delphi - thread does not run in ActiveX form, but elsewhere

I have a thread called TAlertThread. A thread interacts with its owner by triggering events. For example, when certain data is available within a stream, it sets up some temporary variables and Synchronize (UpdateAlert) calls, which in turn trigger the corresponding event.

Now the stream works fine in any standard Windows application. My problem is when I put this thread inside an ActiveX form (TActiveForm). An ActiveX control (similar to a COM object) is then integrated into the Windows Desktop gadget (via HTML / Javascript). I also have experience with this, the gadget is not a problem. The ActiveX component works great in its destination, except that the thread never runs. It is even called EXACTLY the same as I called it from the application.

Is this some limitation with ActiveX by blocking thread execution? I would not think so, because other things that require threads inside (like TADOConnection) work. I actually correctly call CoInitialize and CoUninitialize accordingly. Again, it works great in the application, but generally does not work in ActiveX.

This is what I call this thread ...

procedure TRMPDashXS.ExecThread;
begin
  //Thread created suspended
  lblStatus.Caption:= 'Executing Thread...'; 
  fThread:= TAlertThread.Create(fConnStr); //fConnStr = connection string
  fThread.Priority:=      tpIdle;
  fThread.OnConnect:=     Self.ThreadConnected;
  fThread.OnDisconnect:=  Self.ThreadDisconnected;
  fThread.OnBegin:=       Self.ThreadStarted;
  fThread.OnFinish:=      Self.ThreadFinished;
  fThread.OnAlert:=       Self.ThreadAlert;
  fThread.OnAmount:=      Self.ThreadAmount;
  fThread.Resume; //Execute the thread
end;
+5
source share
2 answers

I suspect that this may determine exactly what you are experiencing in your version of Delphi:

, ... , . , :)

PS: - , Com/ActiveX / TActiveForm?

+7
0

All Articles