program parameter and calling

i have a program that will reside on a "Common PC."  Other PCs can run the program by calling that said program thru the network.  The problem is how do i pass parameters to the called program.  I have looked at the Shell command, but i don't think i can use that command on the calling program since it doesn't have fields that accepts parameter passing.  
Who is Participating?
watyConnect With a Mentor Commented:
Here is a good function to execute application, you can add parameters :

cCommandLine can contains the executable name and all the parameters. You have to treat the parameters in your application.

   hProcess As Long
   hThread As Long
   dwProcessID As Long
   dwThreadID As Long
End Type

   cb                As Long
   lpReserved        As String
   lpDesktop         As String
   lpTitle           As String
   dwX               As Long
   dwY               As Long
   dwXSize           As Long
   dwYSize           As Long
   dwXCountChars     As Long
   dwYCountChars     As Long
   dwFillAttribute   As Long
   dwFlags           As Long
   wShowWindow       As Integer
   cbReserved2       As Integer
   lpReserved2       As Long
   hStdInput         As Long
   hStdOutput        As Long
   hStdError         As Long
End Type


Private Declare Function CreateProcessA Lib "kernel32" (ByVal lpApplicationName As Long, ByVal lpCommandLine As String, ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long

Public Function ShellExecute(cCommandLine As String) As Boolean
   ' #VBIDEUtils#************************************************************
   ' * Programmer Name  : Waty Thierry
   ' * Web Site         :
   ' * E-Mail           :
   ' * Date             : 2/10/98
   ' * Time             : 09:48
   ' * Module Name      : Execute_Module
   ' * Module Filename  : Execute.bas
   ' * Procedure Name   : ShellExecute
   ' * Parameters       :
   ' *                    cCommandLine As String
   ' **********************************************************************
   ' * Comments         :
   ' * Runs a command as the Shell command
   ' * Note: The full path and filename extention
   ' * is required.
   ' * You might want to use Environ$("COMSPEC") & " /c " & command
   ' * if you wish to run it under the command shell (and thus it)
   ' * will search the path etc...
   ' *
   ' * returns false if the shell failed
   ' *
   ' **********************************************************************
   Dim NameStart     As STARTUPINFO
   Dim i             As Long

   NameStart.cb = Len(NameStart)
   i = CreateProcessA(0&, cCommandLine, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, NameStart, NameOfProc)

   If i <> 0 Then
      ShellExecute = True
      ShellExecute = False
   End If

End Function

nasiaAuthor Commented:
which function/procedure goes where.. are all these for the calling program or some will go to the called program.... ????
Add all in a module, and use the following function

 debug.print ShellExecute("C:\yourDir\yourprogram.exe Param1 Param2")
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.