Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Command Arguments

Posted on 2000-02-22
6
Medium Priority
?
266 Views
Last Modified: 2010-05-02
hi, i am wondering how to add command arguments to a program.  say for example, i had an application called app.exe.  i would like to be able to put in the run command "app.exe /form2" and have the application open to form 2.  if i wanted to open form 3, i would put in the run command "app.exe /form3"

i've seen this kinda stuff done before.  particularly, MS internet explorer.  

i am very picky with answers for my questions ...BUT... if someone could give me a very complete sample code on how to do this, i will give you 450 PTS!!!!!!
0
Comment
Question by:llcoolmel
[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
6 Comments
 
LVL 14

Accepted Solution

by:
mcrider earned 1900 total points
ID: 2549258
All you have to do is look at the Command function.... It returns all of the arguments in the command line as a string...


For example:

if instr(1,Command,"/FORM2",1) > 0 then
    MsgBox "/Form2 argument found"
End If


Cheers!
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2549266
By the way, you can pass arguments during development to test your code...

Click "Project->Project Properties..."

On the "Make" tab, There is a text box called "Command Line Arguments:".  Anything you put in that textbox will be passed to your program in Command as if it were typed in on the command line...

Cheers!
0
 
LVL 2

Expert Comment

by:alokanant
ID: 2549400
Go to project properties dialog box,

Make Sub Main as the Startup Object.
Add a form named Form1 to your project.

Add a module to your project
Define the following function in it -

Sub Main()
    If Command = "Form1" Then
        Form1.Show
    End If
End Sub

Now create an exe for your project. If the name of your exe is MyApp.EXE and it is in the root directory then the following command shall show the Form1

C:\MyApp Form1

Type the above command in the Start -> Run dialog box.

hth
Alok.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:llcoolmel
ID: 2556553
Adjusted points to 475
0
 

Author Comment

by:llcoolmel
ID: 2556554
your code works GREAT!!!!  thanks for your answer.  as promised, here's 450 pts PLUS a little extra...
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2556653
Thanks for the points! Glad I could help!


Cheers!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

604 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