Clearing up subclass Shell


In global method, I’m using a subclass Shell like below.

'shell handling…
ReDim mgetRepShell_EVENTVIEWER(-1) // Clear any prior shells

// Create a new shell

With this Shell, I call plink.exe and send ‘tail -f’ command to a remote server. It works well.
However, I noticed that plink.exe executable file is not cleaned up properly after closing Application.
This thing doesn’t happen on other os command such as ls,cat and so on. I think this resulted from the specific ‘-f’ option of ‘tail’ command.

I think if I close the Shell before closing Application, I expect this issue doesn’t happen.
When I try to close the Shell like below in Close event of main Window, I got an error.
– Close event

“Static reference to instance method: call this on an instance of class Shell.”

I believe I’m coding incorrectly.
Can you let me know how to close the Shell?
I’m also using many subclass Shell like this, what is the best practice to clear up the used Shell?

Thanks in advance,

getRepShell_EVENTVIEWER.close refers to the CLASS not the specific instance

you need to refer to the instance you added to the array which is one in the mgetRepShell_EVENTVIEWER array

For i As integer = 0 To Ubound(mgetRepShell_EVENTVIEWER) -1

Thanks. I understand it now.

However, although I closed the Shell, I still see the Plink.exe is running…
Do you think there is any way to kill the process when Application is closed?

you’d probably need to kill the application thats running in the shell