Martti Laine
Martti Laine

Reputation: 12985

Catching the "Open with..." in Visual Basic 2010 Express?

I'm creating a small program for viewing images. However, the whole idea is that it could be used as a default for image-files. So, how can I catch the file, that user tries to open? Path to file is enough. Here's an example:

User right-clicks an image and chooses "My Program" from the "Open with..."-menu. Now I need to see, what file the user wants to see.

I'm an absolute beginner in VB, so please be patient with me =D

Martti Laine

Upvotes: 0

Views: 240

Answers (1)

user111013
user111013

Reputation:

If you create a file association (MSFT KB Article 307859 for details how to do this manually), then your application will be started with the file set as one of the arguments.

You can use Environment.GetCommandLineArgs() to get those arguments.

Upvotes: 1

Related Questions