Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get Window handle from Process ID

1,167 views
Skip to first unread message

Peter Below (TeamB)

unread,
Nov 22, 2001, 4:08:27 PM11/22/01
to
In article <3bfc3e12_1@dnews>, Alex Simonetti wrote:
> I have unsuccessfully tried to write a procedure that gets the handle to the
> first windows of an application based on the process ID of that application.
> For example, in a Delphi application the window handle would be that of the
> Application window (not necessarily the main form).

Define "first window". There is no such concept in windows. If you do an
EnumWindows you get the windows in the current Z order, not in the order they
were created in.


Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.

Leonid Troyanovsky

unread,
Nov 22, 2001, 4:20:41 PM11/22/01
to
Alex Simonetti wrote:

> I have unsuccessfully tried to write a procedure that gets the handle to the
> first windows of an application based on the process ID of that application.
> For example, in a Delphi application the window handle would be that of the

EnumWindows or FindWindowEx and GetWindowThreadProcessId (by z-order)

--
Regards, LVT.

Werner Cloete

unread,
Dec 19, 2001, 9:00:02 AM12/19/01
to

Hi

When you enumerate the windows...is it possible to tell which one is the
"main window/form" so that you could (for instance) send it a message..?
Just wondering... :o)

"Peter Below (TeamB)" <10011...@compuXXserve.com> wrote in message
news:VA.00007e1...@antispam.compuserve.com...


: In article <3bfc3e12_1@dnews>, Alex Simonetti wrote:
: > I have unsuccessfully tried to write a procedure that gets the handle to
the
: > first windows of an application based on the process ID of that
application.
: > For example, in a Delphi application the window handle would be that of
the
: > Application window (not necessarily the main form).
:
: Define "first window". There is no such concept in windows. If you do an
: EnumWindows you get the windows in the current Z order, not in the order
they
: were created in.

:
<SNIP>


Dave Siracusa

unread,
Dec 19, 2001, 9:20:35 PM12/19/01
to
Try GetClassName

"Werner Cloete" <WACloete@OldMutual_NO_SPAM_PLEASE.com> wrote in message
news:3c209d67_2@dnews...

0 new messages