Article View: borland.public.cppbuilder.nativeapi
Article #14783Re: Trying to use a variant type for API/WMI access
From: Bob Gonder
Date: Sun, 03 Aug 2003 03:07
Date: Sun, 03 Aug 2003 03:07
37 lines
2723 bytes
2723 bytes
Maurice Anderson wrote:
>> Bob Gonder wrote:
>> Look carefully at that:
>> MS: string IPAddress[]
>> You: String IPAddress1[2]
>
>Answer - I believe the "s" is the equivalent of "S" in BCB for a string data
>type, so as far as I know, there is no difference.
I can't confirm that, as I have never been able to find where string
is defined in any of the headers. There is just the general belief
that when things don't work right, you should use what the headers say
to use. In this case, that's "string" not "String".
I am also thinking that "string" is supposed to be a C thing that is
essentially char*, whereas "String" is a C++ thing with functions and
sizes and stuff.
>> I would also think that IPAddress1[1] should be emptied.
>Answer - Why?? In either case, I shouldn't get the compiler error.
Well, if you are just passing an array, how is the guy that gets that
array supposed to know how many elements are in it? There are 2 ways
this is usually handled: 1) pass the number of elements (not done in
this case) and 2) have an extra null at the end.
>> Example: "192.168.12.1 192.168.46.1"
>Are you saying the code should read like this:
> ret_code = (Variant(NetAdapter)).Exec(Function("EnableStatic") <<
> "192.168.12.1 192.168.46.1", "255.255.255.0 255.255.255.0");
Well, that's what the MS docs imply: that string is nothing more than
typedef char*string
and that string [] is just concatinated values with blank seperation
and terminating 0.
Technical Details
Message-ID:
<ehuoivkjo1edeg035ei3dhkgm48ef3a43d@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!in.100proofnews.com!in.100proofnews.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f2bfc2f$1@newsgroups.borland.com> <d94oiv8f5kkthiai47n7jtd6kv0rdueinq@4ax.com> <3f2c16a5@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,bc37caa35c7396c7 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-02 20:09:16 PST From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Trying to use a variant type for API/WMI access Date: Sat, 02 Aug 2003 20:07:26 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <ehuoivkjo1edeg035ei3dhkgm48ef3a43d@4ax.com> References: <3f2bfc2f$1@newsgroups.borland.com> <d94oiv8f5kkthiai47n7jtd6kv0rdueinq@4ax.com> <3f2c16a5@newsgroups.borland.com> X-Newsreader: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.31.164.71 X-Trace: newsgroups.borland.com 1059880048 67.31.164.71 (2 Aug 2003 20:07:28 -0700) Lines: 40 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!in.100proofnews.com!in.100proofnews.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail