Hi,

In the code below you can open a file with it's associated program. My question is... does anyone know some code so that I can close the program after it opens? I know a little API stuff, but I can't seem to get anything to work with this. Here's what I am trying to accomplish...

1. The user enters the path to a file to be opened in Text1 textbox.
(ex. C:\Windows\whatever.txt)

2. The user clicks cmdOpen to open the file(with associated program).

3. The user clicks cmdClose to close the opened program.

Your help is greatly appreciated.

Thanks,
Ron

P.S. I'm using VB5.

#################################################

Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal _
lpDirectory As String, ByVal nShowCmd As Long) As Long


Private Sub cmdOpen_Click()
Call ShellExecute(0&,vbNullString,Text1.Text, vbNullString, _
vbNullString, vbNormalFocus)
End Sub

#################################################