🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: FlashWindowEx, USER32.DLL on WinNT

#16599
From: Justin Ridge
Date: Thu, 08 May 2003 15:49
73 lines
3764 bytes
Ed, thanks for your reply.  My app already looks for "plugins" and loads them at runtime, and I use a similar approach to yours for that.  I didn't know if that would be a good idea (e.g. memory- or performance-wise) for a WinAPI call, but I guess it is!  Thanks again.


"Ed Mulroy [TeamB]" <ed@mulroyREMOVETHESECHARS.org> wrote:
>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: <3eba7c80$1@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!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3eba5f0e$2@newsgroups.borland.com> <3eba65af@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 08:53:17 PST
From: "Justin Ridge" <spamstop@terriertech.com>
Sender: "Justin Ridge" <spamstop@terriertech.com>
Reply-To: "Justin Ridge" <spamstop@terriertech.com>
Subject: Re: FlashWindowEx, USER32.DLL on WinNT
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 66.90.248.143 66.90.248.143    
References: <3eba5f0e$2@newsgroups.borland.com> <3eba65af@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3eba7c80$1@newsgroups.borland.com>
Date: 8 May 2003 08:49:20 -0700
X-Trace: newsgroups.borland.com 1052408960 207.105.83.65 (8 May 2003 08:49:20 -0700)
Lines: 74
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail