🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: (ATTN: Remy) Find window handle from exe file name

#13077
From: Martin C
Date: Sat, 25 Oct 2003 22:04
66 lines
3052 bytes
Hi Ed,

Thank you for your reply, actually I solved the Error I was receiving.
Now after compiling the project correctly and running it, I tried to execute
the following code but unfortunately nothing happened and the opened IE
windows remained visible...so can you tell me please what I am missing
here..

P.S. The rest of the code you provided in the attachment I left it *as is*

void __fastcall TForm2::Button1Click(TObject *Sender)
{
  char ie_name[] = "iexplore.exe";
  char *name_used = ie_name;

  HWND h = WindowFromFile(name_used);

    if (!h)
    {  MessageBox(HWND_DESKTOP, name_used, "Could not find IE Program",
MB_OK);
    }
    else
    {

         //Hide the Window.
         ShowWindowAsync(h,SW_HIDE);

         Sleep(10000);

         ShowWindowAsync(h,SW_SHOWNORMAL);
         BringWindowToTop(h);
         SetForegroundWindow(h);
       }
    }
}
//--------------------------------------------------------------------------
-

BR


"Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> wrote in message
news:3f99e98a@newsgroups.borland.com...
> I think he needs to add a define of STRICT, the macro which Microsoft
> created to be used in all Windows programs to set the expansion of the
> header files for work with versions newer than the 16 bit Windows 3.0.
The
> macro must be defined before the inclusion of the Windows header files and
> is best placed in the IDE's Project|Options|Defines/Conditionals or if
using
> the command line as -DSTRICT on the compiler command line to the left of
the
> first file name.
>
> Without the define the Windows header file has an empty list, a (), for
the
> argument list to the prototype of the EnumWindowsProc argument to
> EnumWindows.
>
> This is the same cause as you see causing people to need to cast the
WinProc
> name when they set the pointer value in a WNDPROC structure prior to
calling
> RegisterClass.
>
> .  Ed
Technical Details
Message-ID: <3f9af35c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f930de8@newsgroups.borland.com> <3f930eb2$1@newsgroups.borland.com> <3f931b5b@newsgroups.borland.com> <3f99caaa@newsgroups.borland.com> <3f99d356$1@newsgroups.borland.com> <3f99e98a@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,dcd8305ed53c9568
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-25 15:09:11 PST
From: "Martin C" <martinc@aol.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f930de8@newsgroups.borland.com> <3f930eb2$1@newsgroups.borland.com> <3f931b5b@newsgroups.borland.com> <3f99caaa@newsgroups.borland.com> <3f99d356$1@newsgroups.borland.com> <3f99e98a@newsgroups.borland.com>
Subject: Re: (ATTN: Remy) Find window handle from exe file name
Date: Sat, 25 Oct 2003 14:04:13 -0800
Lines: 68
Organization: V Safe
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: 81.10.4.238
Message-ID: <3f9af35c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1067119452 81.10.4.238 (25 Oct 2003 15:04:12 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail