1 Attachment(s)
Network Card Enable\Disable
As part of my program I need to be able to enable/disable the network cards of the computer. I understand that if I use DHCP enabled network cards I can control them using WMI. But unfortunately I need to use static IP addresses, which renders this method redundant.
Through searching the web I have found this app which does exactly what I want, unfortunately it is in C# and I have very little experience of this language. Could anyone convert this into a VB6 app or give me examples of how to do this in VB6
Re: Network Card Enable\Disable
WMI controls hardware-settings. I think WMI should also work when DHCP is enabled (could be wrong though):
- Because using WMI you can change the mode of an Network card from DHCP to Static.
- DHCP-mode has nothing to do with enableing/disableing the networc card.
Re: Network Card Enable\Disable
Do you have any examples of how to use WMI to achive this? or even an example of the usage of WMI in any application
Re: Network Card Enable\Disable
I do not have a sample but this msdn page should help you:
http://msdn2.microsoft.com/en-us/library/aa394595.aspx
Re: Network Card Enable\Disable
Cheers for that link but having read the first paragraph I don’t think that using WMI will work
Quote:
If you are using DHCP, you can use the Win32_NetworkAdapterConfiguration and the ReleaseDHCPLease method to release the IP address. If you are not using DHCP, you cannot use WMI to disable a network connection. To re-enable the network connection, use objNetCard.RenewDHCPLease. You can also release or renew all DHCP leases using the ReleaseDHCPLeaseAll and RenewDHCPLeaseAll methods.
Any suggestions?
Re: Network Card Enable\Disable
Ignore that last one I have just read the next paragraph:
Quote:
Use the Win32_NetworkAdapter class and the Disable or Enable methods.
Re: Network Card Enable\Disable
I have done some more reading and it would apear that the Enable and Disable functions are only avaiable in Vista!
So any other ideas would be greatly appreciated.