Solved

how to pass a parameter to a software before running

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

757 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

18 Experts available now in Live!

Get 1:1 Help Now