Hi DomAntPallot,
I'd probably make a small server server program (in Delphi) and place it on the remote machine.
If you create a new application and drop a IdHTTPServer onto it (IdHTTPServer is in the Indy components tab), this application will act as a server. You can set it to a specified port, i.e. 6000 then send it commands. If you then set the
CommandGet event for the server, you can close the application you want, as this will be code running locally on that machine.
If the machines name was test, issuing the command http:\\test:6000?action=close in a web browser would fire the
CommandGet event.
Your commandGet event would look something like this:
Code:
procedure TfrmWebServer.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
sAction: String;
begin
AResponseInfo.ContentType := 'text/html';
if (ARequestInfo.Params.Values['action'] <> '') then
begin
sAction := ARequestInfo.Params.Values['action'];
if (sAction = 'close') then
// fire the procedure to close the application
end;
end;
This is handy as it will work through a web browser, so you can do it without using another program to communicate. You do have other options rather then using an IdHTTPServer, such as UDP (IdUDPServer) or TCP (IdTCPServer), howerver you will need to write a delphi program with the equivalent IdUDPClient or IdTCPClient to send requests to the program.
There may be a possibility that you can use WMI (Windows Management Instrumentation). I know that you can query what processes are running, but I am not 100% that you can close and application using WMI. I'll leave it up to you to research.
Hope this helps,
Adam