Click here to Skip to main content
15,921,371 members
Home / Discussions / C#
   

C#

 
AnswerRe: Interacting with forms Pin
Colin Angus Mackay27-Dec-05 3:45
Colin Angus Mackay27-Dec-05 3:45 
AnswerRe: Interacting with forms Pin
AB777127-Dec-05 3:46
AB777127-Dec-05 3:46 
AnswerRe: Interacting with forms Pin
peshkunta27-Dec-05 5:47
peshkunta27-Dec-05 5:47 
QuestionHow to add a service in startup Pin
imsathy27-Dec-05 2:55
imsathy27-Dec-05 2:55 
AnswerRe: How to add a service in startup Pin
VenkataRamana.Gali27-Dec-05 7:21
VenkataRamana.Gali27-Dec-05 7:21 
GeneralRe: How to add a service in startup Pin
imsathy27-Dec-05 19:19
imsathy27-Dec-05 19:19 
Questionfind if word doc is already open (c# win app) Pin
fady_sayegh27-Dec-05 2:39
fady_sayegh27-Dec-05 2:39 
AnswerRe: find if word doc is already open (c# win app) Pin
peshkunta27-Dec-05 3:47
peshkunta27-Dec-05 3:47 
I posted this function before but modified it for your case. Not sure if this will help the finction checks if Microsoft Word program is running and if it is, the function returns true if not, it returns false. You can put this function in a function of a Timer class

//***************************************
//This is just an example of
//executing the function

if (MicrosoftWordIsRunning ()== true)
{
label1.Text = "Microsoft Word is RUNNING!";
}
else label1.Text = "Word is NOT running.";
//*****************************************

that executes the MicrosoftWordIsRunning function at a specified interval - therefore checking every let's say 1000 milliseconds (1 second).


Let me know if you have any questions.

Make sure you include System.Diagnostics:

using System.Diagnostics;//put at the beginning

//put function in class
private bool MicrosoftWordIsRunning()
{
Process[] myProcess = Process.GetProcesses();
int i = 0;

try
{
while (myProcess[i] != null)
{
if (myProcess[i].ProcessName.ToUpper() == "WINWORD")
{
int i2 = 0;

try
{
while (myProcess[i2] != null)
{
myProcess[i2].Close();
i2 += 1;
}
}
catch { }

return true;
}
i += 1;
}
}
catch { }

int i3 = 0;

try
{
while (myProcess[i3] != null)
{
myProcess[i3].Close();
i3 += 1;
}
}
catch { }

return false;
}


-- Don't worry about the world coming to an end today. It's already tomorrow in Australia --

GeneralRe: find if word doc is already open (c# win app) Pin
fady_sayegh27-Dec-05 4:27
fady_sayegh27-Dec-05 4:27 
QuestionLinkLabels array Pin
tray_gator27-Dec-05 2:25
tray_gator27-Dec-05 2:25 
AnswerRe: LinkLabels array Pin
gashach27-Dec-05 6:13
gashach27-Dec-05 6:13 
GeneralRe: LinkLabels array Pin
tray_gator27-Dec-05 22:37
tray_gator27-Dec-05 22:37 
QuestionMinimize problem Pin
CoolASL27-Dec-05 2:19
CoolASL27-Dec-05 2:19 
AnswerRe: Minimize problem Pin
peshkunta27-Dec-05 3:15
peshkunta27-Dec-05 3:15 
GeneralRe: Minimize problem Pin
CoolASL27-Dec-05 18:20
CoolASL27-Dec-05 18:20 
GeneralRe: Minimize problem Pin
peshkunta27-Dec-05 19:04
peshkunta27-Dec-05 19:04 
GeneralRe: Minimize problem Pin
CoolASL27-Dec-05 19:43
CoolASL27-Dec-05 19:43 
GeneralRe: Minimize problem Pin
peshkunta27-Dec-05 20:15
peshkunta27-Dec-05 20:15 
GeneralRe: Minimize problem Pin
CoolASL27-Dec-05 20:21
CoolASL27-Dec-05 20:21 
GeneralRe: Minimize problem Pin
peshkunta27-Dec-05 20:45
peshkunta27-Dec-05 20:45 
GeneralRe: Minimize problem Pin
CoolASL27-Dec-05 20:58
CoolASL27-Dec-05 20:58 
GeneralRe: Minimize problem Pin
peshkunta27-Dec-05 21:35
peshkunta27-Dec-05 21:35 
GeneralRe: Minimize problem Pin
CoolASL27-Dec-05 21:44
CoolASL27-Dec-05 21:44 
GeneralRe: Minimize problem Pin
peshkunta27-Dec-05 21:59
peshkunta27-Dec-05 21:59 
GeneralRe: Minimize problem Pin
CoolASL27-Dec-05 23:27
CoolASL27-Dec-05 23:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.