?
Solved

how to pass a parameter to a software before running

Posted on 2002-07-24
4
Medium Priority
?
150 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
[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
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 320 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 53

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
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 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…
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

764 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