Solved

Right click on file or folder to launch app

Posted on 2002-05-22
7
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 11

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

731 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