Click here to Skip to main content
15,077,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Everyone..

Programatically am trying to run on Microsoft office 2007. The code looks like this:

Collapse | Copy Code

char exe_arr[100]="E:\\setup.exe";
HINSTANCE hInst = ShellExecute(0,"open",exe_arr,"",0,SW_SHOW);


Anyhow after executing this, The code opens the office setup.exe...

And latter Am determining the status of the exe i.e., If exe is running the status is 1, And if exe is quit the status is 0.

To determine the exe status, the code looks like this:

Collapse | Copy Code

int isRunning;
isRunning=FIND_PROC_BY_NAME("setup.exe");


When i execute this code, FIND_PROC_BY_NAME returns 0 status, eventhough setup.exe is running..& it should return 1 status right ?

But this code works fine for other exe applications..

Can anyone tell, Why it is returning 0 status for office setup.exe ??


Thanks in advance..!!
Posted
Comments
nv3 27-Apr-12 7:04am
   
Why are you posting this again? You are probably not going to get any better answers as on your post a day or two ago.
Guru_C++ 2-May-12 0:28am
   
Sorry.. Am not getting any answer..

Try to open the process by using CreateProcess. And you will get a handle to the process. To see if process is alive, then you have to use WaitForSigneObject on that handle. To wait until process finishes y specify INFINITE on the second timeout parameter. But just to test the state you can use 0 timeout.
   
I guess you thought that changing your name would fool us into thinking you are a different person who just happened to ask exactly the same question as this one[^]. Why not make an effort to provide answers to the questions people have already asked you, or follow their suggestions, and you may find you get a solution to your problem.
   
Comments
Guru_C++ 2-May-12 0:28am
   
Sorry.. Am not getting any answer..
Richard MacCutchan 2-May-12 2:55am
   
And you are not likely to. Go back to your original question as I mentioned above and try some of the suggestions, and provide the information you were asked for. If you cannot be bothered to make any effort for yourself do not expect others to do so.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900