🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Odd LoadLibrary Failure

#9029
From: Bob Gonder
Date: Wed, 18 Aug 2004 00:41
16 lines
1567 bytes
Remy Lebeau (TeamB) wrote:

>> HMODULE Dll = LoadLibrary("SHELL32.DLL");
>
>You should never use LoadLibrary() to load SHELL32.DLL or KERNEL32.DLL.
>They are already loaded automatically at program startup, so use
>GetModuleHandle() instead.

Shouldn't hurt any. But your way might be a tad faster.
Main difference is LoadLibrary adds 1 to reference count while
GetModuleHandle doesn't.
Also, don't use FreeLibrary() on a handle you found with
GetModuleHandle.

From the description, I'd be surprised if LoadLibrary doesn't call
GetModuleHandle internally first thing.
Technical Details
Message-ID: <lq85i05semfghu5opjgd34ceb5qbfu34k3@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <41228167$1@newsgroups.borland.com> <412289f4$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,8d61921d2e5eb0c4
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Odd LoadLibrary Failure
Date: Tue, 17 Aug 2004 17:41:02 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <lq85i05semfghu5opjgd34ceb5qbfu34k3@4ax.com>
References: <41228167$1@newsgroups.borland.com> <412289f4$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 65.40.254.192
X-Trace: newsgroups.borland.com 1092789660 65.40.254.192 (17 Aug 2004 17:41:00 -0700)
Lines: 17
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail