×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

MyApplication_StartupNextInstance not always firing

MyApplication_StartupNextInstance not always firing

MyApplication_StartupNextInstance not always firing

(OP)
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, it misses a file with no error or explanation. I'll select 4 files in Win Explorer, right-click on my program, and my program only reports on 3 of them. The code in MyApplication_StartupNextInstance is very simple.

CODE --> vb.net

Private Sub MyApplication_StartupNextInstance(sender As Object, e As StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
   For Each s As String In e.CommandLine
      Form1.addFileToList(s)
   Next
End Sub 

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close