🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: dynamically loading wininet.dll

#3192
From: Remy Lebeau (TeamB)
Date: Mon, 24 Jul 2006 00:39
32 lines
2342 bytes
"Mike Collins" <its@TheBottomOfThePost.com> wrote in message
news:44c3f241$1@newsgroups.borland.com...

> Normally when you call the api, the macro works it our for you i.e. either
> to call the ASCII or Unicode - I didn't realise that you had to specify
this
> when calling GetProcAddress

You have to specify an actual exported name, not the name that the
precompiler macros create for you.

> is there not a standard InternetOpen which then resolves to either
> ASCII or Unicode

No.  That would not be possible.  The whole reason for having A and W
versions of any given function in the first place is because LPTSTR and
LPCTSTR parameters are different - char* for Ansi and wchar_t* for Unicode -
depending on whether UNICODE is defined.  The two are not interchangable at
runtime.  The only reason you can write just InternetOpen() in your code
instead of having to specify InternetOpenA() and InternetOpenW() is because
of the use of precompiler macros that hide that detail from your code.  But
you can't ignore it when you decide to import functions manually instead of
letting the linker do it for you.

> Also, out of interest, what is the exact purpose of the TEXT?

It is a precompiler macro that defines string literals to either char* or
wchar_t* at compile time, depending on whether or not UNICODE is defined.


Gambit
Technical Details
Message-ID: <44c4170b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44c3590d$1@newsgroups.borland.com> <44c3c972$1@newsgroups.borland.com> <44c3f241$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,1c5f45dab245a9b
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <44c3590d$1@newsgroups.borland.com> <44c3c972$1@newsgroups.borland.com> <44c3f241$1@newsgroups.borland.com>
Subject: Re: dynamically loading wininet.dll
Date: Sun, 23 Jul 2006 17:39:26 -0700
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <44c4170b$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1153701643 68.69.17.41 (23 Jul 2006 17:40:43 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail