Oct 132009

I've created small tool(for windows XP/Vista), writen in visual basic 6.this tool was created for switching between static LAN ip to DHCP and back to original static IP (original IP saved in temporary variable) without opening network configuration, And without typing anything, just few mouse click is what we need. This tool using Windows Management Instrumentation for enumerating all network interface, get parameters, and set parameters.

Set objwmiservice = GetObject("winmgmts:\\.\root\cimv2")
Set colNIC_Config = objwmiservice.ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE Index='" & _
                    Netconf.strIFIndex(CboIF.ListIndex) & "' AND IPEnabled=TRUE")
Toggle LAN, DHCP, Static IP, Wireless



I've included source code, so you can freely modify and use it according to your needs. No additinal components's needed here just basic Microsoft Scripting Runtime , Microsoft Shell Control And automation.

Visual basic, VB6, References, Microsoft Scripting Runtime, Microsoft Shell Controls And automation

i've just test it on my desktop and my friend's notebook, i don't know if there's any bug or malfunction on other system.


here's the source code [download#7]


enjoy 🙂

  4 Responses to “Toggle IP From Static to DHCP to Static Tool”

Comments (4)
  1. you left out the module -.-

  2. whooppss, sorry it’s been a long time since i wrote this atricle and prog, i’ve never realized i’ve missed the module 😀 i’ll upload the module soon

  3. i trying write in VB .Net, and still not found the code.
    do you have this application code in VB.NET?

  4. no, i don’t have the code for VB .net, but if you notice the code i wrote in VB is just interfacing to microsoft scripting runtime.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>