Solved

Command Arguments

Posted on 2000-02-22
6
251 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
  • 3
  • 2
6 Comments
 
LVL 14

Accepted Solution

by:
mcrider earned 475 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

705 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

19 Experts available now in Live!

Get 1:1 Help Now