How close other applicatio

  • Thread starter Thread starter PawelR
  • Start date Start date
P

PawelR

Hello group,
Sorry my English is very littel.
I have question about close other application. For example in my application
I have button btCloseWord to close MSWord. How write source code in C#

if (btCloseButton.Click && Word.Open)
Word.Close
if (Word.Closed) MessageShow("Word is closed")

I want use this procedure for other application too.

Thanks PawelR
 
Hi Pawel,

Closing any application is not a common practise.
More i can say, it is very uncommon and unsafe thing.

You can try to do it by Process:

- Process.GetProcesses();
or
- Process.GetProcessesByName(...)

And then get wanted "Process" and:
- CloseMainWindow()
or
- Close()
or
- Kill()

I'd not test it, but it can work...

HTH
Marcin
 
Back
Top