Sending arguments to running programm
-
Hello, I have a program which is always running on user's computer. And I would like to add an item to windows context menu (shell menu), with option to Backup a file (it's not a problem). After user right clicks some file in explorer and then clicks "Backup this file", is it possible to send somehow file path argument to already running program?
-
Hello, I have a program which is always running on user's computer. And I would like to add an item to windows context menu (shell menu), with option to Backup a file (it's not a problem). After user right clicks some file in explorer and then clicks "Backup this file", is it possible to send somehow file path argument to already running program?
You can do this if it exposes an interface for doing so, such as COM, .NET Remoting, or a Web Service, etc. It would be rather difficult, if not impossible in some cases, to gain access to the memory space of the application otherwise.
only two letters away from being an asset
-
Hello, I have a program which is always running on user's computer. And I would like to add an item to windows context menu (shell menu), with option to Backup a file (it's not a problem). After user right clicks some file in explorer and then clicks "Backup this file", is it possible to send somehow file path argument to already running program?
Not something I've done, but try looking into MSMQ messaging. .Net provides support in System.Messaging.MessageQueue. It wasn't totally clear from your post, but assuming that you are writing a shell extension in c#, you could have your shell extension add a message and your running program read the messages from the message queue. TopCoderJax
-
Hello, I have a program which is always running on user's computer. And I would like to add an item to windows context menu (shell menu), with option to Backup a file (it's not a problem). After user right clicks some file in explorer and then clicks "Backup this file", is it possible to send somehow file path argument to already running program?
The WM_SENDMESSAGE message is the easiest way to do this. As others have said, if you mean without changing the source code of the program you want to send the argument to, the answer is no. But, if you want to change the program to work with a shell extension, then that's the way I would do it
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
The WM_SENDMESSAGE message is the easiest way to do this. As others have said, if you mean without changing the source code of the program you want to send the argument to, the answer is no. But, if you want to change the program to work with a shell extension, then that's the way I would do it
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )