Solved

Parammeters to an executable file

Posted on 2002-04-22
3
141 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using "ScreenUpdating" 6 55
Notepad++ how to remove delimiter : from beggning of the line? 3 94
Macro Excel - Multiple If conditions 2 65
VB6 ListBox Question 4 34
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

863 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

18 Experts available now in Live!

Get 1:1 Help Now