Article View: borland.public.cppbuilder.nativeapi
Article #13103Re: Ole Type Msmatch error - Please help if you can
From: Vladimir Afanasyev
Date: Mon, 27 Oct 2003 09:21
Date: Mon, 27 Oct 2003 09:21
37 lines
2092 bytes
2092 bytes
"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>("SetGateways",gateways,metric);
SysFreeString(ip1);
SysFreeString(ip2);
Vladimir.
Technical Details
Message-ID:
<3f9cf1ac$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f9b00ce@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 02:39:08 PST From: "Vladimir Afanasyev" <avv@systema.kiev.ua> Sender: "Vladimir Afanasyev" <avv@systema.kiev.ua> Reply-To: "Vladimir Afanasyev" <avv@systema.kiev.ua> Subject: Re: Ole Type Msmatch error - Please help if you can Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 212.82.216.226 X-Forwarded-For: 192.168.0.147 References: <3f9b00ce@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <3f9cf1ac$1@newsgroups.borland.com> Date: 27 Oct 2003 02:21:32 -0700 X-Trace: newsgroups.borland.com 1067250092 207.105.83.66 (27 Oct 2003 02:21:32 -0700) Lines: 37 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail