Solved

Parammeters to an executable file

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DIR issue 7 54
Restricting text box entry from \/:?<>"| 9 86
Updates not working for MS Windows 7 12 165
MS Date Picker 64 bit 32 bit issue 12 53
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
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 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…

773 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