From: tag on
I'm trying to add an IP address to a pc's network card. In C++ I used
the IPHlpApi.lib's function AddIPAddress. Is there a built in way to
add an IP Address in C#?

Thanks in advance...
From: Leo Seccia on
Hello,

don't think there is a built in way but how about
[DllImport("iphlpapi.dll", SetLastError=true)]
static extern int AddIPAddress(int Address, int IpMask, int IfIndex, out
IntPtr NTEContext, out IntPtr NTEInstance );

if unmanaged is an option then this will do the trick...

look on pinvoke.net for usage.

Leo

"tag" <windsprint(a)gmail.com> wrote in message
news:3bf341e1-952c-4bab-b4b9-894bc3d4b32a(a)34g2000hsf.googlegroups.com...
> I'm trying to add an IP address to a pc's network card. In C++ I used
> the IPHlpApi.lib's function AddIPAddress. Is there a built in way to
> add an IP Address in C#?
>
> Thanks in advance...

From: urkec on
"Leo Seccia" wrote:

> Hello,
>
> don't think there is a built in way but how about
> [DllImport("iphlpapi.dll", SetLastError=true)]
> static extern int AddIPAddress(int Address, int IpMask, int IfIndex, out
> IntPtr NTEContext, out IntPtr NTEInstance );
>
> if unmanaged is an option then this will do the trick...
>
> look on pinvoke.net for usage.
>
> Leo
>
> "tag" <windsprint(a)gmail.com> wrote in message
> news:3bf341e1-952c-4bab-b4b9-894bc3d4b32a(a)34g2000hsf.googlegroups.com...
> > I'm trying to add an IP address to a pc's network card. In C++ I used
> > the IPHlpApi.lib's function AddIPAddress. Is there a built in way to
> > add an IP Address in C#?
> >
> > Thanks in advance...
>
>


There is also WMI and Win32_NetworkAdapterConfiguration class.

--
urkec

From: tag on
On Jul 23, 7:04 am, urkec <ur...(a)discussions.microsoft.com> wrote:
> "Leo Seccia" wrote:
> > Hello,
>
> > don't think there is a built in way but how about
> > [DllImport("iphlpapi.dll", SetLastError=true)]
> > static extern int AddIPAddress(int Address, int IpMask, int IfIndex, out
> > IntPtr NTEContext, out IntPtr NTEInstance );
>
> > if unmanaged is an option then this will do the trick...
>
> > look on pinvoke.net for usage.
>
> > Leo
>
> > "tag" <windspr...(a)gmail.com> wrote in message
> >news:3bf341e1-952c-4bab-b4b9-894bc3d4b32a(a)34g2000hsf.googlegroups.com...
> > > I'm trying to add an IP address to a pc's network card. In C++ I used
> > > the IPHlpApi.lib's function AddIPAddress. Is there a built in way to
> > > add an IP Address inC#?
>
> > > Thanks in advance...
>
> There is also WMI and Win32_NetworkAdapterConfiguration class.
>
> --
> urkec

Thanks for both of your suggestions. I used iphlpapi.dll and it works
okay, I noticed that I have to call it early in my program, or the NIC
card isn't changed before the socket is created...
 | 
Pages: 1
Prev: DatagridView
Next: Using Metafiles