CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2000
    Posts
    2

    Get/Set subnet mask

    I would like to get/set the IP address and subnet mask in a visual basic application. what is the API that I can use? I would prefer to use something that will work without much change across all windows platforms (atleast WIN98/WIN95)

    Any help is appreciated


  2. #2
    Join Date
    Nov 2002
    Location
    Sweden
    Posts
    2

    DhcpNotifyConfigChange

    Hi!! you can use the DhcpNotifyConfigChange in dhcpcsvc.dll,

    I haven’t got it to work. I always get the return value of 2 which is an error code the right code is 0 if the command executed successfully.

    Please msg me if you get it to work!!

    here's the proto:

    BOOL DhcpNotifyConfigChange(
    LPWSTR lpwszServerName, // NULL for local machine
    LPWSTR lpwszAdapterName, // see below
    BOOL fNewIpAddress, // TRUE if IP address modified
    DWORD dwIpIndex, // IP address index (0 based)
    DWORD dwIpAddress, // IP address to set (network order)
    DWORD dwSubNetMask, // Associated subnet mask (network order)
    int nDhcpAction ); // 0on't modify/1:enable/2isable DHCP

    o On NT 4.0, lpwszAdapterName is the "ServiceName" registry value under
    HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\<"n"
    network card index> for your adapter.

    o On W2K, lpwszAdapterName is the "NetCfgInstanceId" registry value
    under
    HKLM\System\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-080
    02be10318}\<"000n" network card index> for your adapter.

    Changes made through DhcpNotifyConfigChange are temporary (they will
    vanish with the next reboot): you will have to set appropriate values in
    the registry to make them permanent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured