?
Solved

Obtaining directory path through Windows

Posted on 2003-11-11
7
Medium Priority
?
155 Views
Last Modified: 2010-05-03
Basically, I need to be able to click on a folder in say, Windows Explorer, then launch my VB program through the right-click context-menu. (the context-menu thing is no problem).

I need my VB program to be able to recognize what I am currently clicking on in the file system. (Basically what I've called it on) Is there any way to do this? (If not using VB then using ANY programming language. I know JAVA and C++ as well so either of those would be great.

For an example of what I've just asked:
If anyone has used winzip, basically u click on the file u want to zip, then you click "compress or zip or whatever in the context menu" and it knows what you're clicking on. I want to do the same thing except ONLY with folders, not files (if that makes it any simpler)

Thanks for your help.
0
Comment
Question by:John_2009
[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
  • 3
7 Comments
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 500 total points
ID: 9727043
Command$ will represent the selected file or folder

Private Sub Form_Load()
If Trim$(Command$) <> "" Then
    MsgBox Command$
End If

End Sub
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 9728223
Just make your context menu command call your app passing it %1.

So in the key HKEY_CLASSES_ROOT\Folder\Shell\MenuText\Command, (where MenuText is the text you want to appear in the context menu, and the value of Command is what to run when the menu item is clicked), you would put:

"full path to your app directory"\yourVBAppName.exe %1

Then in your VB app use code like this:

Option Explicit

Private Sub Form_Load()
    Dim coms As String
    coms = Trim(Command())
    If Len(coms) > 0 Then
        MsgBox "Called from folder: " & coms
    End If
End Sub
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 9872482
Did you ever get it to work John_2009?
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 10164881
vinnyd79 should get the points.

Idle_Mind
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 10537276
Thanks for the guidance Idle_Mind.
Moderator, my recommended disposition is:

    Accept vinnyd79's comment(s) as an answer.

Dan Rollins -- EE database cleanup volunteer
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

762 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