?
Solved

Exe parameter passing (basics for some)

Posted on 2003-03-14
6
Medium Priority
?
166 Views
Last Modified: 2010-05-01
Hi to all

I got a small program that need to pass variables from one to another. Now i want to know how to pass a variable from an apllication to another exe and the other way around aswell if possible. I would apretiate a small working program for testing!! Anyone has an idea???

carlosbueno2000@yahoo.com
0
Comment
Question by:cbueno
[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
  • 2
6 Comments
 

Author Comment

by:cbueno
ID: 8136340
I believe this would be do using the shell command!!
0
 
LVL 14

Expert Comment

by:aelatik
ID: 8136386
Pass it like :

Shell "c:\myexe.exe MyVars"

and fetch it like

MyVar = Command()

0
 
LVL 5

Expert Comment

by:Cimperiali
ID: 8136393
If you're speaking of standard exes, you can pass parameters while shelling:
shell "c:\myexe.exe parm1,parm2,parm3"
and retrieve them in the shelled pgm using Command$ function:
'-------------------
dim retvar as string
dim parms() as string
retvar=Command$
parms=split(retvar,",")
'---------------------
But pass parameters back from shelled one to caller is not that easy. A workaround is to make the called write on a file, and the caller readingf the file from time to time (or - using waitforsingleobject Api - make the caller read the file only once the called pgm has ended its job).
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Accepted Solution

by:
aelatik earned 320 total points
ID: 8136411
Here,

Compile this as an exe and run the file with parameters

Private Sub Form_Load()
Dim CommandVars As String
CommandVars = Command()
If CommandVars <> "" Then MsgBox "You typed '" & CommandVars & "' as parameter", vbInformation
End Sub


Happy Programming,
Ayhan Elatik
0
 

Author Comment

by:cbueno
ID: 8136531
Hi

Cos i am kind of new in this area i have to ask a silly question!!

Now in:  MyVar = Command()

So as what should i declare this variable as???
Does it has to be global???
And if i call it in Form_Load, I just go

Private Sub Form_Load()
MyVar = Command()

End Sub
0
 

Author Comment

by:cbueno
ID: 8136646
Ok Ayhan Elatik

I got it!!! Easier than i thought!!
Full marks =)
Thanks

cbueno
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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 …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 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