Article View: borland.public.cppbuilder.nativeapi
Article #1680Re: Directory Contents
From: Remy Lebeau (TeamB)
Date: Fri, 29 Jun 2007 05:35
Date: Fri, 29 Jun 2007 05:35
50 lines
3205 bytes
3205 bytes
"Jeff" <Jeff@nospam.com> wrote in message
news:4682b382$1@newsgroups.borland.com...
> Gambit please help, I'm trying to use WTSGetActiveConsoleSessionId()
> in BCB 2006 and it says it's an undefined function.
Your value for the _WIN32_WINNT precompiler define is too small. The
winbase.h header declares that function only if the value is 0x501 or
higher. The value is intialized to 0x500 by default.
If you don't want to deal with that, then you can always import the
function dynamically via GetProcAddress() at runtime. You will have
to do that anyway if you want your service to run on pre-XP machines.
If you don't do this, then the executable will fail to run at all on
those older systems.
> When I add "_WIN32_WINNT=0x0501" to the defines I get
> compilation errors from Windows.hpp:
That is because those particular constants are already defined by
Microsoft in winuser.h using #define statements. As is often the
case, Microsoft's use of precompiler statements for declarations
interfers with non-Microsoft environments, such as Borland's. Since
precompiler statements are processed before the compiler runs, the
errors are accurate because the following is what the compiler is
actually seeing:
static const Shortint 0x01 = 0x1;
static const Shortint 0x02 = 0x2;
static const Shortint 0x03 = 0x3;
static const Shortint 0x04 = 0x4;
static const Shortint 0x05 = 0x5;
static const Shortint 0x06 = 0x6;
static const Shortint 0x07 = 0x7;
static const Shortint 0x08 = 0x8;
That is clearly erroneous code. You would have to #undef those
constants in order for Windows.hpp to compile properly.
In addition to that, I find it odd that Borland is not using
$EXTERNALSYM statements in Windows.pas for those constants like it
normally does for all other predefined API constants. So this is a
double-edged issue - Microsoft's annoying coding style coupled with a
bug in Borland's code. Had $EXTERNALSYM been used, those declarations
would not appear in Windows.pas at all, and your code would inherit
the constants from winbase.h directly instead, and all would be good.
Gambit
Technical Details
Message-ID:
<46849bf2$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<46829425@newsgroups.borland.com> <468298db$1@newsgroups.borland.com> <46829f91$1@newsgroups.borland.com> <4682b382$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e2485f93863e826a X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <46829425@newsgroups.borland.com> <468298db$1@newsgroups.borland.com> <46829f91$1@newsgroups.borland.com> <4682b382$1@newsgroups.borland.com> Subject: Re: Directory Contents Date: Thu, 28 Jun 2007 22:35:16 -0700 Lines: 52 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: 75.82.252.126 Message-ID: <46849bf2$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1183095794 75.82.252.126 (28 Jun 2007 22:43:14 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail