Solved

Right click on file or folder to launch app

Posted on 2002-05-22
7
190 Views
Last Modified: 2010-05-02
Hi there,

I need to register all files and folders in Windows for a click on the right mouse button to open a context menu.

The program referred to in the context menu (the one I'm going to write) must get all selected files and folders as a parameter list when the user clicks the context menu entry. What can I do to achieve that? As I interprete from WinRAR's registry entries (I used that as my reference to find out a way to do it), i guess I need to write a COM+ object.

It's definately not enough for me to use HKEY_CLASSES_ROOT\*\shell\... for that because then my test program pops up once for each selected file. For folders, the registry entry does not work either. If you have a solution that way, you're welcome anyway.

So, if needed, where can I find REALLY good COM+ beginner's references and some easy-to-understand exampled? What's the best way to start with COM+?

Using C++ is not an option because my time is very, very limited and I'm really no C++ pro.
0
Comment
Question by:zzconsumer
7 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 7027309
zzconsumer, you can do it using the *\shell method in fact, what you have to do is to create a text box in your application that uses DDE. Set the form as a DDE source and then use App.PrevInstance to detect whether this is the first or a subsequent instance of the application, if it is the first then store the passed command line parameter, if a subsequent one then you use a DDE Poke to the original application to send the filename passed in as the command line parameter to the textbox. Then on the change event of this textbox add it to your list and terminate the subsequent instance, this way you end up with one instance that has a complete list of your selected files. I have a code sample somewhere that uses this method. I will dig it out and post it for you.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 7027316
Here it is in its simple form, just change TDDE to the name of your executable, add two textboxes and set the form to be a DDE source.

Private Sub Form_Load()
  If App.PrevInstance Then
      Text2.LinkTopic = "TDDE|Form1"
      Text2.LinkItem = "Text1"
      Text2.LinkMode = vbLinkAutomatic
      Text2.Text = Command()
      Text2.LinkPoke
      End
  End If
End Sub

Private Sub Text1_Change()
  MsgBox Text1.Text
' Here you would add the new item to a list and / or process this filename.
End Sub
0
 
LVL 1

Author Comment

by:zzconsumer
ID: 7027345
Thanks! There are still some things I'm wondering about:

Still belonging to the question:
Can I register folders the same or a similar way?

And just for interest:
Do I really need to use a Textbox?
Can you give a short explanation why I need two textboxes?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 28

Expert Comment

by:vinnyd79
ID: 7027354
listening
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 100 total points
ID: 7027355
As for folders, I don't actually know but will look into it. Yes you do need to use a textbox, well two in fact because these are controls that support DDE functionality, one to send and one to receive the data. There may be other controls that support this as well but they don't necessarily have the required _Change event to handle new data - the label control is an example of this. I use two textboxes really to avoid confusion, I suppose that you could use just one and treat it as a sender in one instance and a receiver in the other.
0
 
LVL 1

Author Comment

by:zzconsumer
ID: 7027367
That's it! Thanks a lot!
0
 
LVL 10

Expert Comment

by:arana
ID: 7027418
i did something similar, but in a different way,
i added a shortcut to the SENDTO folder, when the userclicks that shortcut, everything that were selected
passes as a parameter to the application referenced in the shortcut.

example:    test.bat shortcut is created in the sendto folder

test.exe contains:

Option Explicit
Sub Main()
MsgBox Command$
End Sub




when you select c:\command.com and right click and sendto test.bat

the msgbox is created with:
C:\command.com

if you select 2 folders and 1 file, the following is created

"C:\Documents and settings" C:\command.com C:\windows

quotes surround names with spaces on them.

you can then parse the command$ as you need it
this is an easy way to do what you want, but i dont know if it works this way when not called from the sendto.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now