Article View: borland.public.cppbuilder.nativeapi
Article #10966ShowWindow API function doesn't work
From: davichu
Date: Mon, 08 Mar 2004 16:27
Date: Mon, 08 Mar 2004 16:27
55 lines
2227 bytes
2227 bytes
Hi
I need to bring to front a specific window using the ShowWindow API
function, but doesn't work.
this is my function :
bool TRunningProcessManager::DisplayWindow( AnsiString args_Process)
{
//local variables
tagPROCESSENTRY32 pe32;
HANDLE snap_hand ;
//initial assignment
snap_hand = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
pe32.dwSize = sizeof(pe32);
//getting system proccess
if ( (int) snap_hand == -1 ) //not stacked for a comprensive code
return false;
if( !Process32First( snap_hand,&pe32 ) ) // not stacked for a
comprensive code
return false;
while( Process32Next ( snap_hand,&pe32 ) ) //moving acrosss processss
{
if( args_Process == pe32.szExeFile )
{
HANDLE ps = OpenProcess(PROCESS_ALL_ACCESS,false,(int)
pe32.th32ProcessID);
if(ps)
{
if( IsWindow(ps) )
{
ShowWindow(ps,SW_RESTORE); //SW_SHOWNORMAL , SW_SHOWNA.....
<=========================== here I try to show the window
return true;
} //end if the handler is a window
} // en if ps is not zero
} // end if both names are equal
} //end while
return false;
}
there is others function like BringWindowToTop() or SetActiveWindow(), but
the results are similar.
thanks for your help
Technical Details
Message-ID:
<404cd7ce@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,ca16847a53213adb,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-03-08 12:34:17 PST From: "davichu" <dmarquezl arroba hotmail punto com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: ShowWindow API function doesn't work Date: Mon, 8 Mar 2004 17:27:11 +0100 Lines: 57 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 200.75.9.107 Message-ID: <404cd7ce@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1078777806 200.75.9.107 (8 Mar 2004 12:30:06 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail