Click here to Skip to main content
15,899,825 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralReplacing file types combo in CFileDialog Pin
12-Jun-01 6:54
suss12-Jun-01 6:54 
GeneralRe: Replacing file types combo in CFileDialog Pin
Ben Burnett12-Jun-01 12:08
Ben Burnett12-Jun-01 12:08 
GeneralRe: Replacing file types combo in CFileDialog Pin
18-Jun-01 6:39
suss18-Jun-01 6:39 
GeneralRe: Replacing file types combo in CFileDialog Pin
20-Jun-01 9:21
suss20-Jun-01 9:21 
QuestionMultimedia in MFC?? Pin
Rickard Andersson2012-Jun-01 6:24
Rickard Andersson2012-Jun-01 6:24 
AnswerRe: Multimedia in MFC?? Pin
RobJones12-Jun-01 7:16
RobJones12-Jun-01 7:16 
AnswerRe: Multimedia in MFC?? Pin
RobJones12-Jun-01 7:18
RobJones12-Jun-01 7:18 
GeneralRunning Programs & Waiting For Them To Finish Pin
Jason Teagle12-Jun-01 4:35
Jason Teagle12-Jun-01 4:35 
I want to run one program from my code in two ways; (a) run it and wait until it closes, and (b) run it, and then later on check if it is still running and if so, shut it down.

I use ShellExecute() to run it (successfully), giving me an HINSTANCE.

I was under the impression that MsgWaitForMultipleObjects() would be able to wait until the program had finished, so I used this:

MsgWaitForMultupleObjects(1,(HANDLE *)&hInst, TRUE, INFINITE, 0);

but it doesn't wait, it just goes right on to the next statement. I also tried QS_ALLINPUT originally for the last parameter; no change. I'm not quite sure what that last parameter does exactly.

So, how do I wait for that program to finish? WaitForSingleObject() says it is not advised to use it in case the run program creates other threads (or something like that, it's all too deep for me), which is why I used MsgWait...().

Also, in 16-bit MFC you could call GetModuleUsage() to find out if the hInst was still running... how do I do this in 32-bit MFC? Also, how do I get a handle to the main window of that EXE from that hInst?

Lastly, some functions such as GetModuleFileNameEx() require a module handle AND a process handle... MSDN says a module is an EXE or DLL, so if my hInst is an EXE, how on Earth do I get the process handle it belongs to? Or are they one and the same in this case?

Help! Smile | :)
GeneralRe: Running Programs & Waiting For Them To Finish Pin
Tomasz Sowinski12-Jun-01 4:44
Tomasz Sowinski12-Jun-01 4:44 
GeneralRe: Running Programs & Waiting For Them To Finish Pin
Jason Teagle12-Jun-01 5:37
Jason Teagle12-Jun-01 5:37 
GeneralRe: Running Programs & Waiting For Them To Finish Pin
Tomasz Sowinski12-Jun-01 5:53
Tomasz Sowinski12-Jun-01 5:53 
GeneralRe: Running Programs & Waiting For Them To Finish Pin
Jason Teagle12-Jun-01 5:58
Jason Teagle12-Jun-01 5:58 
GeneralRe: Running Programs & Waiting For Them To Finish Pin
Tomasz Sowinski12-Jun-01 6:11
Tomasz Sowinski12-Jun-01 6:11 
GeneralRe: Running Programs & Waiting For Them To Finish Pin
Stephen Kellett13-Jun-01 0:01
Stephen Kellett13-Jun-01 0:01 
GeneralRe: Running Programs & Waiting For Them To Finish Pin
Jason Teagle13-Jun-01 0:17
Jason Teagle13-Jun-01 0:17 
GeneralRe: Running Programs & Waiting For Them To Finish Pin
#realJSOP13-Jun-01 1:03
professional#realJSOP13-Jun-01 1:03 
GeneralRe: Running Programs & Waiting For Them To Finish Pin
Carlos Antollini12-Jun-01 4:55
Carlos Antollini12-Jun-01 4:55 
GeneralRe: Running Programs & Waiting For Them To Finish Pin
Jason Teagle12-Jun-01 5:41
Jason Teagle12-Jun-01 5:41 
GeneralRe: Running Programs & Waiting For Them To Finish Pin
Tomasz Sowinski12-Jun-01 5:02
Tomasz Sowinski12-Jun-01 5:02 
GeneralRe: Running Programs & Waiting For Them To Finish Pin
Jason Teagle12-Jun-01 5:43
Jason Teagle12-Jun-01 5:43 
Generalinternet address shortcut Pin
12-Jun-01 4:19
suss12-Jun-01 4:19 
GeneralRe: internet address shortcut Pin
Jason Teagle12-Jun-01 4:37
Jason Teagle12-Jun-01 4:37 
GeneralRe: internet address shortcut Pin
Carlos Antollini12-Jun-01 9:12
Carlos Antollini12-Jun-01 9:12 
GeneralRe: internet address shortcut Pin
12-Jun-01 19:55
suss12-Jun-01 19:55 
Generaletc. information Pin
12-Jun-01 3:59
suss12-Jun-01 3:59 

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.