🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13295

Re: ShowWindow question

#13295
From: Bob Gonder
Date: Sun, 19 Oct 2003 09:04
19 lines
2016 bytes
Martin C wrote:

>Thank you for your reply, actually all I was doing was trying to get the exe
>file window handle based on the exe name, so I am just trying but if you
>recommend any other faster and more efficient way I will appreciate it so
>much.

If you clean up that code as I pointed out, you'd be half way there.
The last thing you did is get the process handle from the process ID,
but you don't need the handle, just the ID for the second half of the
job.
To get the HWND, you need to use EnumWindows to look at every window.
Then in the EnumProc, you would use GetWindowThreadProcessId() to
check if that particular window matched the Proc.th32ProcessID you
found in the first half.

At least, that's my theory on how it's done.
If Gambit is lurking, he might have a better solution.
(I wouldn't doubt it, as this all sounds terribly complicated)
Technical Details
Message-ID: <04k4pvsh9fs51sg560fuq3goh2lfdv1ck4@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!skynet.be!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f90a515@newsgroups.borland.com> <srq1pvg3emp51jq97kjt2tkaqv8uoa5cpm@4ax.com> <3f91b0b3@newsgroups.borland.com> <pee3pv8pp2m367s11uq91tmls2fl4alf8c@4ax.com> <3f91c244@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,644d4ac8e2f18824
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-19 02:09:05 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: ShowWindow question
Date: Sun, 19 Oct 2003 02:04:23 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <04k4pvsh9fs51sg560fuq3goh2lfdv1ck4@4ax.com>
References: <3f90a515@newsgroups.borland.com> <srq1pvg3emp51jq97kjt2tkaqv8uoa5cpm@4ax.com> <3f91b0b3@newsgroups.borland.com> <pee3pv8pp2m367s11uq91tmls2fl4alf8c@4ax.com> <3f91c244@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.166.11
X-Trace: newsgroups.borland.com 1066554264 67.31.166.11 (19 Oct 2003 02:04:24 -0700)
Lines: 21
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!skynet.be!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail