?
Solved

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

Posted on 2007-11-29
5
Medium Priority
?
173 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 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

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:…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

765 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