🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Trying to use a variant type for API/WMI access

#14785
From: Maurice Anderson
Date: Sun, 03 Aug 2003 04:47
52 lines
3164 bytes
Thanks for your insight Bob, i'll try it.  On that note, any ideas on:
 AnsiString T.
  T =  (Variant(NetAdapter.pdispVal)).Exec(PropertyGet("IPAddress"));

This doesn't give a compile error but bombs out in runtime with a "Invalid
variant type conversion error".  IPAddress contains an array of type String
which contains the IP address(es).


"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:ehuoivkjo1edeg035ei3dhkgm48ef3a43d@4ax.com...
> 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: <3f2c9322$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-05!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3f2bfc2f$1@newsgroups.borland.com> <d94oiv8f5kkthiai47n7jtd6kv0rdueinq@4ax.com> <3f2c16a5@newsgroups.borland.com> <ehuoivkjo1edeg035ei3dhkgm48ef3a43d@4ax.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 21:48:01 PST
From: "Maurice Anderson" <mauriceanderson@hotmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f2bfc2f$1@newsgroups.borland.com> <d94oiv8f5kkthiai47n7jtd6kv0rdueinq@4ax.com> <3f2c16a5@newsgroups.borland.com> <ehuoivkjo1edeg035ei3dhkgm48ef3a43d@4ax.com>
Subject: Re: Trying to use a variant type for API/WMI access
Date: Sat, 2 Aug 2003 21:47:12 -0700
Lines: 54
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 64.30.203.223
Message-ID: <3f2c9322$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1059885858 64.30.203.223 (2 Aug 2003 21:44:18 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-05!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail