-
Method to report if a process exits.
hey guys,
help me out please,
My program calls a windows program say windows media player.
I start it and give the process a name so i know the name of
process and can stop it any time. But.. I want that when user
exits the windows media player, should the next statement of program run.
I tried using ->hasExited method and made the whole program sleep as windows media player once running is independent of it , only when it exit
should the program wake up again. But if I make it sleep it crashes and does not respond. Is there any thing like do nothing and wait. I have also
tried ->Responding but still not much output.
I ll try to register my program thread and then make it sleep but do not know it will work or not. Anybody has a better idea.
The problem looks very simple but the solution is tricky.
Please help me out.
cheers,
nadz
-
Hi,
have a look at MSDN. Search for:
Enumerating All Modules For a Process, Process Status Helper and EnumProcesses. That should give you the information you need. You might need to download the platform SDK from the microsoft site (I think download.microsoft.com)
Cheers,
D
DKyb
-------------------------------
Life is a short warm moment -
Death is the long cold rest.
Pink Floyd
-------------------------------
-
I think you should start the program using CreateProcess function. In this case you will obtains the handle of the launched process, which can be later used in a wait function.
You can try this:
Code:
PROCESS_INFORMATION pi;
STARTUPINFO si = { sizeof(STARTUP_INFO) };
CreateProcess( "WMPlayer.exe", NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
Now you have the handle of the started process in pi structure. In order to wait for termination, execute this:
Code:
WaitForSingleObject(pi.hProcess, INFINITE);
Hope it helps.
-
Thanks for reply.
I think i m using the equivalent in .net, I have got into another problem now.
I need help for ping command. I need to save the results of ping command.
I am starting a new thread too for it.
Thanks
Similar Threads
-
By Mike in forum VB Classic
Replies: 2
Last Post: 01-27-2007, 07:28 AM
-
Replies: 1
Last Post: 04-21-2006, 11:51 AM
-
Replies: 1
Last Post: 04-13-2006, 04:57 AM
-
By Jugg in forum VB Classic
Replies: 3
Last Post: 04-03-2006, 12:40 AM
-
By Maxx in forum VB Classic
Replies: 5
Last Post: 07-07-2000, 02:04 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|