Article View: borland.public.cppbuilder.nativeapi
Article #10974Re: ShowWindow API function doesn't work
From: Remy Lebeau (TeamB)
Date: Tue, 09 Mar 2004 00:41
Date: Tue, 09 Mar 2004 00:41
28 lines
1887 bytes
1887 bytes
"davichu" <dmarquezl arroba hotmail punto com> wrote in message
news:404cfd85@newsgroups.borland.com...
> if( !Process32First( snap_hand,&pe32 ) )
> return false;
>
> while( Process32Next ( snap_hand,&pe32 ) )
You are skipping the first process altogether. Change your code to use a
do...while() loop instead.
> if( args_NombreProceso == pe32.szExeFile )
You should use a case-insensitive comparison, such as AnsiSameText().
> mihandler = OpenProcess(PROCESS_ALL_ACCESS,false,(int)
> pe32.th32ProcessID);
> if(mihandler)
> {
> SetForegroundWindow(mihandler);
You are trying to focus a process handle, not a window handle. They are not
the same thing. You have to find the window handle manually. Look at the
EnumWindows() and GetWindowThreadProcessId() functions.
Gambit
Technical Details
Message-ID:
<404d10b6@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<404cd7ce@newsgroups.borland.com> <404cdaa0$1@newsgroups.borland.com> <404cfd85@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,ca16847a53213adb X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-03-08 16:40:17 PST From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <404cd7ce@newsgroups.borland.com> <404cdaa0$1@newsgroups.borland.com> <404cfd85@newsgroups.borland.com> Subject: Re: ShowWindow API function doesn't work Date: Mon, 8 Mar 2004 16:41:44 -0800 Lines: 30 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 67.22.138.253 Message-ID: <404d10b6@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1078792374 67.22.138.253 (8 Mar 2004 16:32:54 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail