Formular una preguntaFormular una pregunta
 

Preguntaopen Network properties UI from VB

  • martes, 25 de agosto de 2009 20:02Playwolf Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Hi, I am developing a new shell for a windows project using VB2008.

    I would like to open the network IP properties for the Local Area Connection, in order for the user to change the IP address for the computer.

    I have done some research, but can't find any way of doing this through Process.Start("RunDll32.exe", "shell32.dll,....... like I have done with the other items I needed from the control panel, and the information I do find tells me to use the INetCfgComponent::RaisePropertyUi.

    Unfortunatly I have no idea in how to use this function from within VB....

    Any information on how to do this would be greatly appreciated.

    Thanks,

    Robin.
    Welcome to my world

Todas las respuestas

  • viernes, 28 de agosto de 2009 19:57Malange Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    try to find the answer here:

    http://www.computerhope.com/forum/index.php?topic=77071.0

    http://www.codeguru.com/vb/

    all the best for you...
    DeepF1
  • martes, 01 de septiembre de 2009 18:17Playwolf Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    The reply is not really very helpful... I have searched google and bing until I have gone blue in the face! I cannot seem to find any examples, someone must have done this!

    Robin.
    Welcome to my world
  • jueves, 24 de septiembre de 2009 13:07Playwolf Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Please, someone must have done this in the past, even if it is in c# or c++, It is starting to get important now!

    Many thanks,

    Robin.
    Welcome to my world
  • jueves, 24 de septiembre de 2009 16:50Malange Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Hi, I am developing a new shell for a windows project using VB2008.

    I would like to open the network IP properties for the Local Area Connection, in order for the user to change the IP address for the computer.

    I have done some research, but can't find any way of doing this through Process.Start("RunDll32.exe", "shell32.dll,....... like I have done with the other items I needed from the control panel, and the information I do find tells me to use the INetCfgComponent::RaisePropertyUi.

    Unfortunatly I have no idea in how to use this function from within VB....

    Any information on how to do this would be greatly appreciated.

    Thanks,

    Robin.
    Welcome to my world
    I would like to open the network IP properties for the Local Area Connection, in order for the user to change the IP address for the computer.
     I thing its imponsible to change the IP via Code..........

    I did some resaerch as well but I cannot find it
    Don't judge me, just Upgrade me. Thanks!
  • miércoles, 04 de noviembre de 2009 21:18Playwolf Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Tiene código
    OK, I found a possible solution:

    Imports System.Management
    
    
    Public Class SelectNetworkAdapter
        Dim ConnectionName As String = Nothing ' = "Local Area Connection"
    
        Private Sub SelectNetworkAdapter_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            '"Local Area Connection"
            getNetworkAdapters(ConnectionName)
            lstNetworkAdapter.SelectedItem = lstNetworkAdapter.Items.Item(0)
            If lstNetworkAdapter.Items.Count = 1 Then
                openNetworkConnectionProperties()
            End If
    
    
        End Sub
    
        Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
            openNetworkConnectionProperties()
        End Sub
    
        Public Sub openNetworkConnectionProperties()
            lstNetworkAdapter.Enabled = False
            btnOK.Enabled = False
            Dim SelectedAdapter As String = getNetworkAdapterGUID(lstNetworkAdapter.SelectedItem)
            'MsgBox(SelectedAdapter)
            Shell("explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}\::" & SelectedAdapter)
            Me.Close()
        End Sub
    
    
    
        Private Function getNetworkAdapters(Optional ByVal ConnectionName As String = "")
            Try
                '
                ' Create the query, in SQL syntax, to retrieve the properties from
                ' the active Network Adapter.
                '
                Dim strQuery As String
                If Not ConnectionName = "" Then
                    strQuery = String.Format("SELECT * FROM Win32_NetworkAdapter  WHERE AdapterType = 'Ethernet 802.3' AND NetConnectionID LIKE '{0}'", ConnectionName)
                Else
                    strQuery = "SELECT * FROM Win32_NetworkAdapter  WHERE AdapterType = 'Ethernet 802.3'"
                End If
                '    "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True"
    
                '
                ' Create a ManagementObjectSearcher object passing in the query to run.
                '
                Dim query As ManagementObjectSearcher = New ManagementObjectSearcher(strQuery)
    
                '
                ' Create a ManagementObjectCollection assigning it the results of the query.
                '
                Dim queryCollection As ManagementObjectCollection = query.Get()
    
                '
                ' Loop through the results extracting the MAC Address.
                '
    
                Dim mo As ManagementObject
    
                Dim strObject As String = Nothing
    
                For Each mo In queryCollection
                    strObject = mo("Description")
                    lstNetworkAdapter.Items.Add(strObject)
                Next
    
                Return True
    
            Catch ex As Exception
                MsgBox(ex.Message)
                Return False
    
            End Try
    
    
        End Function
    
    
        Private Function getNetworkAdapterGUID(ByVal Description As String)
            Try
                '
                ' Create the query, in SQL syntax, to retrieve the properties from
                ' the active Network Adapter.
                '
                Dim strQuery As String = _
                String.Format("SELECT * FROM Win32_NetworkAdapterConfiguration  WHERE Description LIKE '{0}'", Description)
    
                '    "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True"
    
                '
                ' Create a ManagementObjectSearcher object passing in the query to run.
                '
                Dim query As ManagementObjectSearcher = New ManagementObjectSearcher(strQuery)
    
                '
                ' Create a ManagementObjectCollection assigning it the results of the query.
                '
                Dim queryCollection As ManagementObjectCollection = query.Get()
    
                '
                ' Loop through the results extracting the SettingID/GUID of the device.
                '
    
                Dim mo As ManagementObject
    
                Dim strObject As String = Nothing
                For Each mo In queryCollection
                    strObject = mo("SettingID")
    
                Next
    
                Return strObject
    
            Catch ex As Exception
                MsgBox(ex.Message)
                Return False
    
            End Try
    
    
        End Function
    
        Public Sub New()
    
            ' This call is required by the Windows Form Designer.
            InitializeComponent()
    
            ' Add any initialization after the InitializeComponent() call.
    
        End Sub
    End Class
    
    It works fine on Vista and 7, but when trying it with XP (which is the one it NEEDS to work on, it fails to show the dialog box.

    the main part of the code is: Shell("explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}\::" & SelectedAdapter)

    Does anyone have a solution, or know where I could find one?


    Regards,


    Robin.
    Welcome to my world