Solved

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

Posted on 2007-11-29
5
170 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
[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
  • 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

Technology Partners: 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!

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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 use and create new code templates in NetBeans IDE 8.0 for Windows.

695 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