Solved

Creating program to add functionality to right click context menu. Need to grab all command line arguments.

Posted on 2007-11-29
5
161 Views
Last Modified: 2013-11-26
I am working on creating a small app that will allow a user to right click on one (or more) files in a directory and click on "Create PDF's" or "Combine All Into 1 PDF".

I am using PDF Creators COM interface and I have all of that programming done. What I need to do is be able to read in multiple file names. So whether the user right clicks on one file or multiples, I will be able to read all of the file names into variables and then perform the requested action.

So I guess I just need help reading command line arguments and determining how many were passed.

Thanks,

Ryan
0
Comment
Question by:EOGRIS
  • 3
  • 2
5 Comments
 
LVL 18

Accepted Solution

by:
jcoehoorn earned 500 total points
ID: 20375426
If you're staring up a form directly, you need to use a module instead.  Create a new module with a public sub named "Main" like this:
Module MainModule
    Public Sub Main(ByVal CmdArgs() As String)
        '...
    End Sub
End Module

Then to use that sub go to the project's properties page, make sure "Enable Application Framework" is NOT checked, and you should be able to choos "Sub Main" as a start up object.  Now if you need to show a form you can do so from the sub, and the command line arguments are available in the CmdArgs parameter for the sub.
0
 

Author Comment

by:EOGRIS
ID: 20381487
Okay I got that part, but I don't know how to break out the different file names.

So if someone right clicks on like 4 files, and then selects my application in the context menu, those 4 file names will be sent as command line arguments to my application. So I need to know how to seperate those file names out, probably using an array.

Just can't find the right code.
0
 
LVL 18

Expert Comment

by:jcoehoorn
ID: 20381989
CmdArgs is already an array, and should hold one file name at each index.
0
 

Author Comment

by:EOGRIS
ID: 20382034
Okay so I just need to check the length of CmdArgs and then loop through it to get all the file names that were passed to it?
0
 
LVL 18

Expert Comment

by:jcoehoorn
ID: 20382092
Yep.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

757 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

21 Experts available now in Live!

Get 1:1 Help Now