Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Parammeters to an executable file

Posted on 2002-04-22
3
Medium Priority
?
147 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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 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…
Suggested Courses

722 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