My app processes files and is called from the right-click context menu from Windows Explorer. The user selects one or more files, right-clicks on the selection, then picks my app from the context menu. The behaviour of Windows is to call the app once for each file in the selection, and the filename is passed as an argument. Since my app is a "single instance application", I need to use the MyApplication_StartupNextInstance event to capture all the filenames selected. It works - most of the time. Every once in a while (1 out of 5 or so), it misses a file with no error or explanation. I'll select 4 files in Win Explorer, right-click, select my program, and my program only reports on 3 of them. I get the same anomaly with both Debug and Release compiles.
The code in MyApplication_StartupNextInstance is very simple - it adds the command line param to a CheckedListBox on my main form.
Looking for a tip from someone who has also seen this (and figured it out). Any troubleshooting tips are also welcome. I've tried some debugging code right at the start of this Sub, and it is definitely not firing when this situation occurs.
Thanks,
Mike
The code in MyApplication_StartupNextInstance is very simple - it adds the command line param to a CheckedListBox on my main form.
Code:
Private Sub MyApplication_StartupNextInstance(sender As Object, e As StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
For Each s As String In e.CommandLine
Form1.lstFiles.Items.Add(s, CheckState.Checked)
Next
End Sub
Thanks,
Mike