Closing shell application!

J

jonesfranckandi

hi, everyone,

I do have a question. I hope anyone you can
help me. I have a formula in vb that call a shell application. In
fact
it calls a media player. Now it works fine. But I do have and exit
button on the form. I assign this code: Application.quit. That is the
code I entered to close the shell application. But Access closes
instead and the application still running. I want that when the
button
is clicked the application closes not access. Does anyone think they
can
help me?. Here take a look at this code:


Private Sub PlayMovie_Click()
'check if Field is empty
Dim stAppName As String
If IsNull(Me.txtMP3) Or Me.txtMP3 = "" Then
Me.txtMP3.SetFocus
MsgBox "Please, Select a Movie or a Music File.", vbOKOnly +
vbExclamation, " Empty Field"
Exit Sub
End If
'take cases
If Me!Fr.Value = 1 And Me!Frmovie.Value = 2 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Real Player is The Appropriate Media For This File.",
vbExclamation, "Invalid Media"
Me!Frmovie.Value = 1
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 2 And Me!Frmovie.Value = 2 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Real Player is The Appropriate Media For This File.",
vbExclamation, "Invalid Media"
Me!Frmovie.Value = 1
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 3 And Me!Frmovie.Value = 1 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Window Media Player is The Appropriate Media For This
File.", vbExclamation, "Invalid Media"
Me!Frmovie.Value = 2
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 4 And Me!Frmovie.Value = 1 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Window Media Player is The Appropriate Media For This
File.", vbExclamation, "Invalid Media"
Me!Frmovie.Value = 2
Me.txtMP3 = ""
Exit Sub
End If
'start playing movie


If Me!Frmovie.Value = 1 Then
stAppName = "C:\Program Files\Real\RealPlayer\realplay.exe "
Call Shell(stAppName, 1)
Application.FollowHyperlink Me.txtMP3
Me.txtMP3 = ""
Else
If Me!Frmovie.Value = 2 Then
stAppName = "C:\Program Files\Windows Media Player\wmplayer.exe"
Call Shell(stAppName, 1)
Application.FollowHyperlink Me.txtMP3
Me.txtMP3 = ""
Else
Exit Sub
End If
End If


End Sub
-------------------------------------------------------------------
Private Sub Close_Click()


Me.txtMP3 = ""
DoCmd.close acForm, "Media", acSaveYes
Application.quit
End Sub


My concern is the last bit for Close_click. I which it to close or
exit application as soon as the user click on it.Note that this is
only the first bit of my code behind the form. I have an another code
that let the user select a file movie or music to play.


Your help would be the most welcome. If anyone has any suggestions he
can jump in as well.
Thanks in adavnce!!!!!
 
J

John Nurick

See http://www.mvps.org/access/api/api0025.htm

hi, everyone,

I do have a question. I hope anyone you can
help me. I have a formula in vb that call a shell application. In
fact
it calls a media player. Now it works fine. But I do have and exit
button on the form. I assign this code: Application.quit. That is the
code I entered to close the shell application. But Access closes
instead and the application still running. I want that when the
button
is clicked the application closes not access. Does anyone think they
can
help me?. Here take a look at this code:


Private Sub PlayMovie_Click()
'check if Field is empty
Dim stAppName As String
If IsNull(Me.txtMP3) Or Me.txtMP3 = "" Then
Me.txtMP3.SetFocus
MsgBox "Please, Select a Movie or a Music File.", vbOKOnly +
vbExclamation, " Empty Field"
Exit Sub
End If
'take cases
If Me!Fr.Value = 1 And Me!Frmovie.Value = 2 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Real Player is The Appropriate Media For This File.",
vbExclamation, "Invalid Media"
Me!Frmovie.Value = 1
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 2 And Me!Frmovie.Value = 2 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Real Player is The Appropriate Media For This File.",
vbExclamation, "Invalid Media"
Me!Frmovie.Value = 1
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 3 And Me!Frmovie.Value = 1 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Window Media Player is The Appropriate Media For This
File.", vbExclamation, "Invalid Media"
Me!Frmovie.Value = 2
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 4 And Me!Frmovie.Value = 1 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Window Media Player is The Appropriate Media For This
File.", vbExclamation, "Invalid Media"
Me!Frmovie.Value = 2
Me.txtMP3 = ""
Exit Sub
End If
'start playing movie


If Me!Frmovie.Value = 1 Then
stAppName = "C:\Program Files\Real\RealPlayer\realplay.exe "
Call Shell(stAppName, 1)
Application.FollowHyperlink Me.txtMP3
Me.txtMP3 = ""
Else
If Me!Frmovie.Value = 2 Then
stAppName = "C:\Program Files\Windows Media Player\wmplayer.exe"
Call Shell(stAppName, 1)
Application.FollowHyperlink Me.txtMP3
Me.txtMP3 = ""
Else
Exit Sub
End If
End If


End Sub
-------------------------------------------------------------------
Private Sub Close_Click()


Me.txtMP3 = ""
DoCmd.close acForm, "Media", acSaveYes
Application.quit
End Sub


My concern is the last bit for Close_click. I which it to close or
exit application as soon as the user click on it.Note that this is
only the first bit of my code behind the form. I have an another code
that let the user select a file movie or music to play.


Your help would be the most welcome. If anyone has any suggestions he
can jump in as well.
Thanks in adavnce!!!!!
 
J

jonesfranckandi

Thanks guys

but I am not so sure how to run fEnumWindows in the debug window. I
opened and application(the shell on) then tried to look for the
classname with that method and it didn't display anything. Can you
clarify thing for me please.
thanks in advance!!!!!!!!

Seehttp://www.mvps.org/access/api/api0025.htm

hi, everyone,
I do have a question. I hope anyone you can
help me. I have a formula in vb that call a shell application. In
fact
it calls a media player. Now it works fine. But I do have and exit
button on the form. I assign this code: Application.quit. That is the
code I entered to close the shell application. But Access closes
instead and the application still running. I want that when the
button
is clicked the application closes not access. Does anyone  think they
can
help me?. Here take a look at this code:
Private Sub PlayMovie_Click()
'check if Field is empty
Dim stAppName As String
If IsNull(Me.txtMP3) Or Me.txtMP3 = "" Then
Me.txtMP3.SetFocus
MsgBox "Please, Select a Movie or a Music File.", vbOKOnly +
vbExclamation, " Empty Field"
Exit Sub
End If
'take cases
If Me!Fr.Value = 1 And Me!Frmovie.Value = 2 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Real Player is The Appropriate Media For This File.",
vbExclamation, "Invalid Media"
Me!Frmovie.Value = 1
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 2 And Me!Frmovie.Value = 2 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Real Player is The Appropriate Media For This File.",
vbExclamation, "Invalid Media"
Me!Frmovie.Value = 1
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 3 And Me!Frmovie.Value = 1 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Window Media Player is The Appropriate Media For This
File.", vbExclamation, "Invalid Media"
Me!Frmovie.Value = 2
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 4 And Me!Frmovie.Value = 1 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Window Media Player is The Appropriate Media For This
File.", vbExclamation, "Invalid Media"
Me!Frmovie.Value = 2
Me.txtMP3 = ""
Exit Sub
End If
'start playing movie
If Me!Frmovie.Value = 1 Then
stAppName = "C:\Program Files\Real\RealPlayer\realplay.exe "
Call Shell(stAppName, 1)
Application.FollowHyperlink Me.txtMP3
Me.txtMP3 = ""
Else
If Me!Frmovie.Value = 2 Then
stAppName = "C:\Program Files\Windows Media Player\wmplayer.exe"
Call Shell(stAppName, 1)
Application.FollowHyperlink Me.txtMP3
Me.txtMP3 = ""
Else
Exit Sub
End If
End If
Me.txtMP3 = ""
DoCmd.close acForm, "Media", acSaveYes
Application.quit
End Sub
My concern is the last bit for Close_click. I which it to close or
exit application as soon as the user click on it.Note that this is
only the first bit of my code behind the form. I have an another code
that let the user select a file movie or music to play.
Your help would be the most welcome. If anyone has any suggestions he
can jump in as well.
Thanks in adavnce!!!!!--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.- Hide quoted text -- Show quoted text -
 
J

jonesfranckandi

Thanks

I managed to find out how to see the classname. Many thanks guys you
are great.

Thanks guys

but I am not so sure how to run fEnumWindows in the debug window. I
opened and application(the shell on) then tried to look for the
classname with that method and it didn't display anything. Can you
clarify thing for me please.
thanks in advance!!!!!!!!

On 28 Jan 2007 08:01:36 -0800, (e-mail address removed) wrote:
hi, everyone,
I do have a question. I hope anyone you can
help me. I have a formula in vb that call a shell application. In
fact
it calls a media player. Now it works fine. But I do have and exit
button on the form. I assign this code: Application.quit. That is the
code I entered to close the shell application. But Access closes
instead and the application still running. I want that when the
button
is clicked the application closes not access. Does anyone ?think they
can
help me?. Here take a look at this code:
Private Sub PlayMovie_Click()
'check if Field is empty
Dim stAppName As String
If IsNull(Me.txtMP3) Or Me.txtMP3 = "" Then
Me.txtMP3.SetFocus
MsgBox "Please, Select a Movie or a Music File.", vbOKOnly +
vbExclamation, " Empty Field"
Exit Sub
End If
'take cases
If Me!Fr.Value = 1 And Me!Frmovie.Value = 2 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Real Player is The Appropriate Media For This File.",
vbExclamation, "Invalid Media"
Me!Frmovie.Value = 1
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 2 And Me!Frmovie.Value = 2 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Real Player is The Appropriate Media For This File.",
vbExclamation, "Invalid Media"
Me!Frmovie.Value = 1
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 3 And Me!Frmovie.Value = 1 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Window Media Player is The Appropriate Media For This
File.", vbExclamation, "Invalid Media"
Me!Frmovie.Value = 2
Me.txtMP3 = ""
Exit Sub
End If
If Me!Fr.Value = 4 And Me!Frmovie.Value = 1 Then
MsgBox "You Can't Play this File with The Selected Media." & vbCrLf &
vbCrLf & "Window Media Player is The Appropriate Media For This
File.", vbExclamation, "Invalid Media"
Me!Frmovie.Value = 2
Me.txtMP3 = ""
Exit Sub
End If
'start playing movie
If Me!Frmovie.Value = 1 Then
stAppName = "C:\Program Files\Real\RealPlayer\realplay.exe "
Call Shell(stAppName, 1)
Application.FollowHyperlink Me.txtMP3
Me.txtMP3 = ""
Else
If Me!Frmovie.Value = 2 Then
stAppName = "C:\Program Files\Windows Media Player\wmplayer.exe"
Call Shell(stAppName, 1)
Application.FollowHyperlink Me.txtMP3
Me.txtMP3 = ""
Else
Exit Sub
End If
End If
End Sub
-------------------------------------------------------------------
Private Sub Close_Click()
Me.txtMP3 = ""
DoCmd.close acForm, "Media", acSaveYes
Application.quit
End Sub
My concern is the last bit for Close_click. I which it to close or
exit application as soon as the user click on it.Note that this is
only the first bit of my code behind the form. I have an another code
that let the user select a file movie or music to play.
Your help would be the most welcome. If anyone has any suggestions he
can jump in as well.
Thanks in adavnce!!!!!--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.- Hide quoted text -- Show quoted text -- Hide quoted text -- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top