🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Still In Hell (LoadLibrary)

#13925
From: Leo Havm�ller
Date: Tue, 09 Sep 2003 05:51
23 lines
1675 bytes
>     libHandleC = LoadLibrary(str.c_str());
>     if (mu::fileExists(str)) debug.textOutEnd("FileExists == true");
//non-VCL version of
>                 //FileExists, Line 7
>     else debug.textOutEnd("FileExists == false");
>     if (!libHandleC) {
>        debug.textOutEnd("Library not loaded.  Following is Windows error
msg:"); //Line 8
>        mu::showLastSysError(debug);
>        }

The last error is lost by all the other stuff you do before calling
GetLastError(), so the wrong errorcode is shown.
If LoadLibrary fails, call GetLastError() right away. Save it in a temp
variable:

libHandleC = LoadLibrary(str.c_str());
if (!libHandleC)
{
    errorcode = GetLastError();
}

Leo Havm�ller.
Technical Details
Message-ID: <3f5d6a4a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3F5D1326.2050005@anonymous_one.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10cc67,adeb054a441a66c4
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-08 22:53:10 PST
From: "Leo Havm�ller" <leh@-nospam-rtx.dk>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3F5D1326.2050005@anonymous_one.com>
Subject: Re: Still In Hell (LoadLibrary)
Date: Tue, 9 Sep 2003 07:51:06 +0200
Lines: 25
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: 80.63.27.146
Message-ID: <3f5d6a4a$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1063086666 80.63.27.146 (8 Sep 2003 22:51:06 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail