PhilAI
asked on
Already Running Applications and Command-Line Arguments
I have an application I want to load files by double clicking, the following questions came from my attempts:
1. How do you pass command-line arguments to an application if it is already running, and the AppActivate procedure does not manage to activate the application except when running from VB?
2. How do you clear a command-line argument?
Thank you, Phil
1. How do you pass command-line arguments to an application if it is already running, and the AppActivate procedure does not manage to activate the application except when running from VB?
2. How do you clear a command-line argument?
Thank you, Phil
You can't pass a command-line argument to an application that is already running.
If you are trying to control an application that is not your own, you may be able to control it if you can reference the other application's object library in your Visual Basic application. If the application you are launching is your own VB app, then you can establish communication between the apps using COM methods, or windows sockets, or a common location in the registry to pass values, etc.
AppActivate is purely a VB, VBA or VBSCript command, but you should be able to "activeate" any application where you know the exact window title.
A command-line argument inside of your own VB app is simply a variant array, and you can just set it to Empty, or ignore it.
If you are trying to control an application that is not your own, you may be able to control it if you can reference the other application's object library in your Visual Basic application. If the application you are launching is your own VB app, then you can establish communication between the apps using COM methods, or windows sockets, or a common location in the registry to pass values, etc.
AppActivate is purely a VB, VBA or VBSCript command, but you should be able to "activeate" any application where you know the exact window title.
A command-line argument inside of your own VB app is simply a variant array, and you can just set it to Empty, or ignore it.
From your question I understand that you're trying to pass some data to an existing (already running?) application from the launched application. You can refer a program from here http://zephyrit.netfirms.com/PassString.Zip (right-click on choose Save Target As...) for knowing about passing strings from an application to already running application.
To use that program. Extract the zip file and open the ReceiveData.vbp first and start it and then open SendData.vbp and start that. check how it is tranmitting strings and numerics. Hope that helps.
NOTE: command-line arugments wont help you in this context as timd_jones said.
To use that program. Extract the zip file and open the ReceiveData.vbp first and start it and then open SendData.vbp and start that. check how it is tranmitting strings and numerics. Hope that helps.
NOTE: command-line arugments wont help you in this context as timd_jones said.
ASKER
timd_jones: Thank you for confirming that; it is in fact my own appication and I have used Winsock control before.
How would I set it the command-line to empty, exactly?
Thanks
How would I set it the command-line to empty, exactly?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That works, bit dodgy, but it works - it is not like I want to use the Command-line again after.
Thank you
Thank you
ASKER
1. How do you pass command-line arguments to an application if it is already running, and the AppActivate procedure does not manage to activate the application except when running from VB?
2. How do you clear a command-line argument?
Thank you, Phil