Mr. E 6 Posted July 2, 2021 (edited) Greetings, I need your guidance. I made an ActiveX control which I need to use in one big applications (ParnetMenu) for various containers, but it is somewhat elaborate to update. So, to get out of trouble, I made an emergent application as a simple container for this ActiveX control. On my development machine, the application closes correctly and disappears from the processes running on Windows 10 pro 64 bit (virtualized in virtualbox). The problem occurs with end users (Windows 10 pro 64 bit), when closing the application it remains running in the windows processes and it is necessary to go and terminate the process manually. In fact, my main application (ParnetMenu) where I will use this control, suffers the same problem but there we programmed a button that looks for the id of each container and closes the process, using the TDOSCommand component and performs a Taskkill to close the screens that use these ActiveX controls. (Force closure) exe := stringReplace(button.Caption, ' ', '_', [rfReplaceAll, rfIgnoreCase]); button.visible := false; PID := escribeVar(exe); PID := 'Taskkill /F /PID ' + PID; dos.CommandLine := PID; dos.Execute; In this emergent application I have tried several things, attached actual and previous code: First by clicking on "X" in the application I release the control and Terminates de application. It did not work. Second. Then I removed the buttons and add a panel with a button to try another way. Same result the application remains running in the background: The layout of the application: This is the code for this emergent container: unit MainForm; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs , SALMVCC_To_Cancel_AX_TLB, RzButton, Vcl.ExtCtrls, System.ImageList, Vcl.ImgList, Vcl.StdCtrls ; type TMain = class(TForm) il1: TImageList; pnl1: TPanel; bb1: TRzBitBtn; lbl1: TLabel; procedure FormCreate(Sender: TObject); procedure bb1Click(Sender: TObject); private { Private declarations } var CADISalidasCancelacionAutorizacion: TcoADI_SALMVCC_To_Cancel; procedure doLoadOCX; public { Public declarations } end; var Main: TMain; implementation {$R *.dfm} procedure TMain.bb1Click(Sender: TObject); begin lbl1.Visible:= True; self.Refresh; Sleep(200); // to give time for the message to be displayed. CADISalidasCancelacionAutorizacion.Destroy; Sleep(500); // to give time for the message to be released? Application.Terminate(); Sleep(2500); // Just to debug this problem System.Halt(0); //TerminateProcess; // don't know how to use yet end; procedure TMain.doLoadOCX; begin CADISalidasCancelacionAutorizacion := TcoADI_SALMVCC_To_Cancel.Create(self); CADISalidasCancelacionAutorizacion.Parent:= self; CADISalidasCancelacionAutorizacion.Align:= alClient; end; {procedure TMain.FormClose(Sender: TObject; var Action: TCloseAction); begin CADISalidasCancelacionAutorizacion.Free; Application.Terminate; end;} procedure TMain.FormCreate(Sender: TObject); begin doLoadOCX; end; end. I had previously used this, but it didn't work either. procedure TMain.FormClose(Sender: TObject; var Action: TCloseAction); begin CADISalidasCancelacionAutorizacion.Free; Application.Terminate; end; Note: My PC has no antivirus running (except Microsoft's), my users use Avast and there is already an exception for them not to send the application to the sanbox. I even tried disabling the antivirus on a computer and the problem persists. Regards and thank you. ------- Addendum: The main goal is not only to solve this problem with the emergent application. But also to eliminate the use of TaskKill in my ParnetMenu application; and to eliminate the hang that occurs. And of course, occasionally I will be able to create more definitive applications using the ActiveX container. Edited July 2, 2021 by Mr. E fix + addendum Share this post Link to post