Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Sending arguments to running programm

Sending arguments to running programm

Scheduled Pinned Locked Moved C#
linuxhelpquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Monin D
    wrote on last edited by
    #1

    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?

    N D C 3 Replies Last reply
    0
    • M Monin D

      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?

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • M Monin D

        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?

        D Offline
        D Offline
        Dave Herren
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • M Monin D

          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?

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          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 )

          M 1 Reply Last reply
          0
          • C Christian Graus

            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 )

            M Offline
            M Offline
            Monin D
            wrote on last edited by
            #5

            Thanks very much for all answers, was very helpful. Did it with messaging, because it was easy and fast :)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups