Article View: comp.os.ms-windows.programmer.win32
Article #2185Re: RasEnumConnections always returns 0 entries
From: Vic Metcalfe
Date: Sun, 18 Jan 1998 00:00
Date: Sun, 18 Jan 1998 00:00
35 lines
1816 bytes
1816 bytes
John Lockwood wrote:
>
> That's because your passing NumConnections as is to the function,
> which expects a pointer to the number. Try passing @NumConnections.
> You see, if you want to spot pointer errors, ask a C++ programmer; we
> have more experience making them. ;-)
Thanks for your reply John. I should have mentioned that the pointer
parameters would be confusing to c and c++ people. In pascal (or at
least in Delphi, and I think in standard pascal as well) you can declare
a parameter to be a reference, and the compiler will automatically make
it a pointer, so:
procedure double(var x:integer);
begin
x:=x*2;
end;
Would take a reference to an integer and double it. The code calling
the procedure would simply say:
x:=2;
double(x);
{x now should be 4}
The Delphi declaration for RasEnumConnections uses this technique to
hide the referencing and dereferencing from the programmer. I can tell
that this much works correctly because a) it doesn't give an access
violation, and b) the values are set to zero on return.
I'll have a go at this in c and see where it takes me.
Thanks again,
Vic.
Technical Details
Message-ID:
<34C2888D.1343A0C3@zymsys.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34C2110A.166E918B@zymsys.com> <34c24450.0@calwebnnrp>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb362,727dba52da29726b X-Google-Attributes: gidfb362,public X-Google-Thread: 113dfb,727dba52da29726b X-Google-Attributes: gid113dfb,public From: Vic Metcalfe <vic@zymsys.com> Subject: Re: RasEnumConnections always returns 0 entries Date: 1998/01/18 Message-ID: <34C2888D.1343A0C3@zymsys.com> X-Deja-AN: 317179423 Content-Transfer-Encoding: 7bit References: <34C2110A.166E918B@zymsys.com> <34c24450.0@calwebnnrp> Content-Type: text/plain; charset=us-ascii Organization: Zymurgy Sytems Mime-Version: 1.0 Newsgroups: comp.os.ms-windows.programmer.win32,borland.public.delphi.internet