|
-
Aug 16th, 2006, 07:06 PM
#1
Thread Starter
Fanatic Member
How to run a process modally?
Process A starts process B. How does process A ensure that process B's window runs modally?
-
Aug 16th, 2006, 07:27 PM
#2
Re: How to run a process modally?
I hope this works
Code:
Control c = Control.FromHandle(proc.MainWindowHandle);
if(c is Form){
return ((Form)c).Modal;
}
By the way, it's 2.0
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Aug 16th, 2006, 07:53 PM
#3
Thread Starter
Fanatic Member
Re: How to run a process modally?
Thanks. Even though that code doesn't work (because c always evaluates to null), I got a cue enough to wend my way:
At least I got a handle of that process, which if I were on my own, I would have procured through PROCESS_INFO, CreateThreadProcessID, GetWindowFromProcessID etc.
Now, I can call SetParent(hWnd, hWndParent) on that window handle. Won't make it modal but will help a great deal.
Thanks again.
-
Aug 16th, 2006, 08:09 PM
#4
Re: How to run a process modally?
I'm not sure that you understand what "modal" means. A modal window is one that sits on top of another and doesn't allow access to that other form until the modal form is dismissed. If you want your app to do that with an external executable then you do it like this:
VB Code:
Process p = Process.Start("executable path here");
p.WaitForExit();
Now your app will block until the app you started exits. If you want to do this with an existing process then you need to create a Process object for that running process.
From what you posted in post #3 it looks like you want to make an external application's window an MDI child of your own. Which is it?
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
|
Click Here to Expand Forum to Full Width
|