🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: FlashWindowEx, USER32.DLL on WinNT

#16594
From: Ed Mulroy [TeamB]
Date: Thu, 08 May 2003 14:11
66 lines
3302 bytes
That is how it is supposed to work.  When you call the function in your code
that generates a record in the executable saying that a function of that
name from that DLL is required.  The Windows program loader will load any
required DLL's and fill in the address in every place their functions are
called.  Because no matching function was found, no address value to place
into the code is available and the error is generated.

You might instead try doing something like the code I show below.  It loads
the function address at runtime instead of relying on the program loader to
load it.

I used GetModuleHandle because that DLL should already be loaded.  By using
that function instead of LoadLibrary you are freed from the need to call
FreeLibrary.

  --------------
  BOOL (WINAPI *FlashWindowExPtr)(PFLASHWINFO);
  HINSTANCE user32_hinst = GetModuleHandle("USER32.DLL");

  (FARPROC) FlashWindowExPtr =
      GetProcAddress(user32_hinst, "FlashWindowEx");

  if  ((user32_hinst != NULL) && (FlashWindowExPtr != NULL))
      {
      FLASHWINFO info = {sizeof(FLASHWINFO), 0};

      info.hwnd = Application->Handle;
      info.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;
      info.uCount = 100;
      FlashWindowExPtr(&info);
      }
  else
      {
      FlashWindow(Application->Handle, true);
      }
  --------------

.  Ed

> Justin Ridge wrote in message
> news:3eba5f0e$2@newsgroups.borland.com...
>
> My app uses the FlashWindowEx function.  It works
> great when running on Win98 or Win2000.  When the
> app runs on WinNT, I get the error "The procedure
> entry point FlashWindowEx could not be located in the
> dynamic link library USER32.DLL".
>
> I understand that FlashWindowEx is not supported on
> WinNT, and my code checks for its availability (see below).
> However, this error occurs IMMEDIATELY when I start the
> app, i.e. way before FlashWindowEx would ever be called.
>
> How can I get the app to start on WinNT?
>
> PS. The code I use to check for the availability of FlashWindowEx
> is below.  ...
>     :
> if (newversion) {
>   FLASHWINFO info = {sizeof(FLASHWINFO), 0};
>   info.hwnd = Application->Handle;
>   info.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;
>   info.uCount = 100;
>   FlashWindowEx(&info);
> } else
>   FlashWindow(Application->Handle, true);
Technical Details
Message-ID: <3eba65af@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3eba5f0e$2@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,2866fa51de16e98a
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-08 07:22:54 PST
From: "Ed Mulroy [TeamB]" <ed@mulroyREMOVETHESECHARS.org>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3eba5f0e$2@newsgroups.borland.com>
Subject: Re: FlashWindowEx, USER32.DLL on WinNT
Date: Thu, 8 May 2003 10:11:35 -0400
Lines: 68
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.1106
NNTP-Posting-Host: 206.228.162.64
Message-ID: <3eba65af@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1052403119 206.228.162.64 (8 May 2003 07:11:59 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail