w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Identify process id of word instance using System.Diagnostics.Process object

What about that (untestet):

Updated

Word.Application wdapp;
try 
{     
    Process wordProcess = System.Diagnostics.Process.Start("Path to
WINWORD.EXE");
    wdApp =
(Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
} 
catch (COMException) 
{
     Type type = Type.GetTypeFromProgID("Word.Application");
     wdapp = System.Activator.CreateInstance(type);
 } 

The wdApp should be the started word. And you get the process id through wordProcess instance.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.