1

I have a winform application that works with/for third party exes. These third party apps do not have any api or command line parameters. Is it possible to control third party apps from winform application using c#.

All I need is:-

  • Open third party exe within winform app. Winform will work as a container.
  • let the users uses thirdy party apps
  • then Exit/End/Close third party exe by winform app.

Any help will be appreciated.

user1327064
  • 4,187
  • 5
  • 20
  • 30

2 Answers2

1

I think you can use Process.Start

But the application won't work as container.

http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx

Process.Start return system.diagnostics.process object which can be used to stop it

http://msdn.microsoft.com/en-us/library/system.diagnostics.process

Massimiliano Peluso
  • 26,379
  • 6
  • 61
  • 70
1

Yes, you can do this for many apps by re-parenting. See here for starters.

I mentioned many apps which implies "not all." For example, the Windows calculator will give you headaches if you try to switch modes (Standard, Scientific etc.) because each mode change creates a new window. MS Word also has a complex windowing scheme. But things like Notepad and other straightforward apps will work.

So you need to get/start the process, get the process' window handle and the set the parent to be your application's window.

Here's another usful link for getting a process' window handle.

Community
  • 1
  • 1
Paul Sasik
  • 79,492
  • 20
  • 149
  • 189