Solved

how to pass a parameter to a software before running

Posted on 2002-07-24
4
147 Views
Last Modified: 2010-05-02
hi experts,
i want to automatically run a software from windows registry and must pass a parameter to it,
eg,
"c:\software\chema.exe /windowsreg"

i want the sofware to take the variable windowsreg so it can distinguish who initialized the software .

thank u in advance,
Waleed Abul makarem
0
Comment
Question by:waleed_makarem
4 Comments
 
LVL 28

Expert Comment

by:vinnyd79
ID: 7175033
have you tried:

Private Sub Command1_Click()
Shell "command.com /c c:\software\chema.exe /windowsreg"
End Sub
0
 
LVL 5

Accepted Solution

by:
bob_online earned 80 total points
ID: 7175106
Your question can be interpreted several ways.

To run your program automatically, add the a key under
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\Run

Name the key chema
and for the value add c:\software\chema.exe /windowsreg

The program will now run every time the pc is started.

If, however, your question is how can your program read the value "windowreg", then in your start up form or module, check Command$:

If Command$ = "windowreg" then
  Do something
else
   Do Something different
end if
0
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 7176597
You can do it also by using ShellExecute API as below:

Private Declare Function ShellExecute Lib "shell32" _
    Alias "ShellExecuteA" _
   (ByVal hwnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long
   
i = ShellExecute(Hwnd, "Open", "c:\software\chema.exe", "/windowsreg", 0&, 1)
0
 

Author Comment

by:waleed_makarem
ID: 7188506
thank u for ur answer,
i wanted to make my software know this parameter by the
command$ paramer in ur answer,

thank u all for ur interest.
and sorry for the confusion in this question.

waleed
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…

809 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