Hi everyone!
How can i run a exe from a dll and pass a variable to the exe?
Thanks.
Printable View
Hi everyone!
How can i run a exe from a dll and pass a variable to the exe?
Thanks.
In your dll you can have something like this:
whereCode:Public Sub RunExe(prog As String, arglist As String)
Shell prog & " " & arglist, vbNormalFocus
End Sub
- PROG must have full exe path+name
- and arglist is some list of command line arguments
In the program that will run on main ,form_load OR sub main you'll have to parse command line args like this:
Code:Private Sub Form_Load()
Dim myComArgs As String
myComArgs = Command()
'you take from here...
End Sub
Good answer, but I'd tend to generalize it to:
Paths often have spaces, etc. in them.Code:Public Sub RunExe(prog As String, arglist As String)
Shell """" & prog & """ " & arglist, vbNormalFocus
End Sub
Thanks but then you have to add Error Handler, "turn" sub into a function ... and so on ... :)Quote:
Originally Posted by dilettante
But I agree, dbl quotes most likely needed.