P
pamela fluente
Given p (as a process) how do I get the MainForm (let's assume that it
might exist) ?
-P
might exist) ?
-P
Can you explan this a little bit more Pamela?
pamela fluente said:Given p (as a process) how do I get the MainForm (let's assume that
it might exist) ?
Given p (as a process) how do I get the MainForm (let's assume that it
might exist) ?
-P
I have to ask you what the purpose of this is? Also is the process you
are looking for a program you designed or one that a third party
created?
Thanks,
Seth Rowe
For now I am planning to use within "a program I designed", but, of
course,
it also would be nice to know the general answer, which, I guess,
could be quite complicate.
In other words, is it possible, given only the handle of a process to
get the MainForm?
-P
I guess my question is how do you define "MainForm"? In an MDI
application I would assume you are trying to find the MDI Parent, and
a single SDI would be the only shown form. You might be able to use
the Window's API and loop through the process handle's associated
windows and pick out the MainForm from there - but I'm not sure of a
reliable way of doing this.
By the way, what are the chances you would know the title of the
MainForm from the program that starts the process. If you know that,
you could easily use the FindWindow API to grab the MainForm.
I'm still curious, what are you planning to do to the MainForm once
you get a reference to it? Or is this just an academic exercise?
Thanks,
Seth Rowe- Nascondi testo tra virgolette -
- Mostra testo tra virgolette -
Given p (as a process) how do I get the MainForm (let's assume that it
might exist) ?
You can't get a winforms Form object representing a window in another
process and do something useful with it, if that's what you're asking.
You can get the window handle, but that's about it.
Mattias