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
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.
- Use the thread tools to Mark your Thread as Resolved when your question is answered.
- Please Rate my answers if they where helpful.
Cheers for that link but having read the first paragraph I don’t think that using WMI will work
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.