Solved

how to pass a parameter to a software before running

Posted on 2002-07-24
4
145 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 49

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

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
SSRS expression Issue finding a string 10 65
Sending a email via excel using vba 6 71
vb6 connector to SQL Server 2 34
Add a task in Outlook from access 11 35
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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

932 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

20 Experts available now in Live!

Get 1:1 Help Now