In my C# background (Tray) application, I am checking if foreground application is Office Word application, using following Function. It is working perfectly.
- bool WinWordApp()  
 - {   
 -    IntPtr hwnd = GetForegroundWindow();  
 -    BringWindowToTop(hwnd);  
 -    uint pid;  
 -    GetWindowThreadProcessId(hwnd, out pid);  
 -    Process p = Process.GetProcessById((int)pid);  
 -    string AppName = null;  
 -    AppName = p.ProcessName.ToString();  
 -    if (AppName.IndexOf("WinWord", StringComparison.CurrentCultureIgnoreCase) != -1)  
 -       return true;  
 -    else  
 -       return false;  
 - }  
 
My query: Using this pid / p / AppName, I want to just set font in the foreground Word application, to say “Arial”, without touching other attributes like font size, underline, bold etc.   On the net I got some clues like:
- objWord.Activewindow.Selection.Font.Name = "Arial"  
 
But I don’t know how to club these two.
 
Please help.