|
-
Jan 29th, 2013, 06:26 PM
#1
Thread Starter
Addicted Member
How to add explorer right click menu item for my program?
I got a program with a listview in it, and I would like to know how to add files through explorer to my program, like select a bunch of files, right click one of them and add all the files to the listview (with files I mean full file names & paths). I need the general idea of this, am not asking for a copy-paste code, I need some guides as I don't know what to google for.
I know you add some registry keys somewhere in ClassesRoot, and maybe create some CLSID key which I don't know what it is, so anything related will be helpful.
Last edited by Legjendat; Jan 30th, 2013 at 04:18 PM.
-
Jan 29th, 2013, 06:48 PM
#2
Re: How to add explorer right click menu item for my program?
What's wrong with the OpenFileDialog? Or do yyou mean that you want to be able to right click on Explorer to open your application with the chosen files? In that case, here's your Google search.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Jan 29th, 2013, 07:00 PM
#3
Thread Starter
Addicted Member
Re: How to add explorer right click menu item for my program?
 Originally Posted by dunfiddlin
What's wrong with the OpenFileDialog? Or do yyou mean that you want to be able to right click on Explorer to open your application with the chosen files? In that case, here's your Google search.
Y, I meant the second one, and I'm looking into it right now. OpenFileDialog has been used already, as well as Drag & Drop, but I want the Explorer ContextMenuItem as well to make my app complete regarding methods of adding files to that listview.
-
Jan 30th, 2013, 06:48 AM
#4
Thread Starter
Addicted Member
Re: How to add explorer right click menu item for my program?
Ok, I made some progress, but still I'm not quite what I want to accomplish. My code is below, and it's very simple, but either I'm doing something wrong, or it is the wrong code for the job, or I need to add something. What it does is that for each file I selected it will open a new instance of my program with the respective file in the listview items. But I want all the items in one instance, and if my application is already open, don't create a new instance, but add the files to the listview.
I created my registrykey in ClassesRoot\*\shell\MyApp\command where I set the default value to "D:\Users\Legjendat\Documents\Visual Studio 2010\Projects\Test Project\Test Project\bin\Debug\Test Project.EXE "%1""
Any suggestions, or am I going the wrong way at it?
vb.net Code:
Public Sub AddFilesToListView(filePath As String) ListView1.Items.Add(filePath) End Sub Public Sub Form1_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If My.Application.CommandLineArgs.Count > 0 Then AddFilesToListView(My.Application.CommandLineArgs(0)) Else ' 'If app is opened normally, do nothing. End If End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|