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. how to open program through C# program and give this program focus

how to open program through C# program and give this program focus

Scheduled Pinned Locked Moved C#
csharptutorialquestion
4 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.
  • E Offline
    E Offline
    E_Gold
    wrote on last edited by
    #1

    hi how to open program through C# program and give this program focus ? thank's in advance

    A B 2 Replies Last reply
    0
    • E E_Gold

      hi how to open program through C# program and give this program focus ? thank's in advance

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      E_Gold wrote:

      how to open program through C# program and give this program focus ?

      You mean, you want to run one application. You can easily do it using Process.Start[^]Process.Start

      Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

      S 1 Reply Last reply
      0
      • A Abhijit Jana

        E_Gold wrote:

        how to open program through C# program and give this program focus ?

        You mean, you want to run one application. You can easily do it using Process.Start[^]Process.Start

        Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

        S Offline
        S Offline
        SimpleData
        wrote on last edited by
        #3

        and after starting it with Process.Start(), you can focus to it by pinvoking SetForegroundWindow(). For more info on SetForegroundWindow() http://msdn.microsoft.com/en-us/library/ms633539(VS.85).aspx[^]

        1 Reply Last reply
        0
        • E E_Gold

          hi how to open program through C# program and give this program focus ? thank's in advance

          B Offline
          B Offline
          binhvtt
          wrote on last edited by
          #4

          Hope this part of code can help you. Process AgentIDEProcess = new Process(); AgentIDEProcess.StartInfo.FileName = "AgentIDE.exe"; string AgentIDEArgument = DirPath + " " + lwSpecFileName + " " + inputFileName + " " + outputFileName; // CurDir + " // + sourceId.ToString() + ".xml " + sourceId.ToString() + "input.xml " + sourceId.ToString() + "output.xml"; //AgentIDEArgument = AgentIDEArgument + " " + sourceId.ToString() + "eoptions.xml"; //AgentIDEArgument += " " + sourceId.ToString() + LWFile; Console.WriteLine("Arguments: " + AgentIDEArgument); AgentIDEProcess.StartInfo.Arguments = AgentIDEArgument; AgentIDEProcess.Start(); AgentIDEProcess.WaitForExit();

          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