my_process_Exited is never fired

graham knight 1 Reputation point
2022-04-01T19:18:58.583+00:00

I have moved to a new PC and from VS 2019 Community to VS 2022 Community. I have a treeview control in my program and double-click a node to run a video, spawning the default video player. This all works and the video plays fine. When the video completes the user closes the default video player and what happened in VS 2019 is the myProcess_Exited is fired to update an xml file to remember the video has been played.

This is the treeview code and it all works, what isn't happening is myProcess_Exited is never entered. I have tried removing and re-clicking the exited event with no luck. I have set enableraisingevents at design time no change. have i unintentionally deleted something that is required to get this routine to fire. I did find one similar question but it was coded in C which I don't have any experience of.

Private Sub TreeView1_NodeMouseDoubleClick(sender As Object, e As TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseDoubleClick
' to start the video file we need the full path in the file system.
' Play the video with the default app for this filetype.

    myProcess.StartInfo.FileName = TreeView1.SelectedNode.FullPath
    MyProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized
    myProcess.EnableRaisingEvents = True

    ' Play the video and wait for the user to stop it.
    myProcess.Start()

End Sub
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,668 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 83,206 Reputation points
    2022-04-01T20:16:26.3+00:00

    It depends on the application which plays video files (some UWP apps don't work with this event)
    You can force it to wmplayer for example :

     myProcess.StartInfo.FileName = "wmplayer.exe"
     myProcess.StartInfo.Arguments = TreeView1.SelectedNode.FullPath
    
    1 person found this answer helpful.
    0 comments No comments