Solved

Parammeters to an executable file

Posted on 2002-04-22
3
140 Views
Last Modified: 2011-04-14
Hi Experts,

   How do i make to receive external parameters in my application?

   I have a callcenter software that let me launch an external application passing 5 differents parameters like the number that is calling me etc,etc.

  How can i do a VB project that receive this parameters to make various conditions depending on the number that is calling me?

Thsnka
0
Comment
3 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 50 total points
Comment Utility
Hi Masteraco,

something along the lines of

Sub Main()

Dim strCmdLine As String

  strCmdLine = UCase(Trim(Command()))
  If strCmdLine <> "" Then
    'dosomething here
  End If
end sub

or multiple params like

<a>/<b>/<c> and loop trough the string in your program splitting all params from the line

:O)Bruintje
0
 
LVL 44

Expert Comment

by:Arthur_Wood
Comment Utility
to follow up on bruintje's answer, you should read, in the VB help system about the Command$ function, which is a method of the App object, which is always instantiated in a VB program.

YOu can access its using either the Command$ function, just like that:

Dim strCommand as String

strCommand = Command$

or as

strCommand = App.Command$

What you are asking about are called "COmmand Line arguments", and how you structure the "command line" is ENTIRELY up to you.

for instance, some programs have start-up parameters, indicated by letters such as /i=...  for (i)nput, /a=... for (a)rguments, /x=... for an X value and so on, and that way the user can supply the parameters in ANY order, as long as they indicate which parameters are being used:

MyPrograme.exe /i=12 /a=15 /x=5

or

MyPrograme.exe /a=15 /x=5 /i=12

  would be the same, but you would need to 'parse' the command string, to extract the parameters for each value;

In the first case, the Command$ would be "/i=12 /a=15 /x=5"  and in the second case the Command$ would be "/a=15 /x=5 /i=12" . Both cases the values a i, a and x would be the same, but you would need to split up the Command$ string to get the values that were being used.

If you need some help with how to do that, just ask.

Arthur Wood
0
 
LVL 1

Expert Comment

by:kavithag
Comment Utility
Whatever parameters U re passing can be used as Command  Line argiments in VB. During Runtime U can access the
parameters by Command(0),Command(1),.. etc
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

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 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

11 Experts available now in Live!

Get 1:1 Help Now