Solved

how to pass a parameter to a software before running

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA error replacing data 6 39
Using "ScreenUpdating" 6 63
TT Auto Dashboard 13 92
VB 6 error 5 in windows 10 but not in XP 7 55
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

785 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