🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Ole Type Msmatch error - Please help if you can

#13127
From: Maurice Anderson
Date: Tue, 28 Oct 2003 05:57
45 lines
2301 bytes
Thank You!!

"Vladimir Afanasyev" <avv@systema.kiev.ua> wrote in message
news:3f9cf1ac$1@newsgroups.borland.com...
>
> "Maurice Anderson" <mauriceanderson@hotmail.com> wrote:
> >Hello I have succesfully setup and used WMI with class
> >Win32_NetworkAdapterConfiguration.  I have ran quite a few functions such
as
> >EnableDNS.  When I try to execute function  SetGateways, I get an error.
> >Can someone look over this function call and see if you see anything?  I
> >know it should work cause like I said I have ran some other functions.
> >
> >     ret_code = (Variant(NetAdapter)).
> >                Exec(Function("SetGateways") << ("10.0.0.8","10.0.0.9")
<<
> >(1,2));
> It is incorrect.
>
>
> Parameters for SetGateways is Variant array.
> Code must be follow:
>
> int Bounds[]={0,1};
> Variant gateways=Variant(Bounds, 1, varOleStr);
>
> BSTR ip1=SysAllocString(L"10.0.0.8");
> BSTR ip2=SysAllocString(L"10.0.0.9");
> gateways.PutElement(ip1,0);
> gateways.PutElement(ip2,1);
>
> //for Win2000 only
> int Bounds1[]={0,1};
> Variant metric=Variant(Bounds1, 1, varSmallint);
> metric.PutElement(1,0);
> metric.PutElement(2,1);
> //
>
> int
result=(Variant(NetAdapter.pdispVal)).OleFunction<Variant,Variant>("SetGatew
ays",gateways,metric);
> SysFreeString(ip1);
> SysFreeString(ip2);
>
> Vladimir.
Technical Details
Message-ID: <3f9e045d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp.abs.net!ash.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3f9b00ce@newsgroups.borland.com> <3f9cf1ac$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,1a5d5a1a83f5ea8f
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-27 21:58:46 PST
From: "Maurice Anderson" <mauriceanderson@hotmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References:  <3f9b00ce@newsgroups.borland.com> <3f9cf1ac$1@newsgroups.borland.com>
Subject: Re: Ole Type Msmatch error - Please help if you can
Date: Mon, 27 Oct 2003 21:57:01 -0800
Lines: 47
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: <3f9e045d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1067320413 64.30.203.223 (27 Oct 2003 21:53:33 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp.abs.net!ash.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail