Solved

Parammeters to an executable file

Posted on 2002-04-22
3
144 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
ID: 6961474
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
ID: 6961681
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
ID: 6962599
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

820 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