Jump to content

Need help about Network sharing


Go to solution Solved by Danyfirex,

Recommended Posts

Hi

I making a small tool that create wifi Hotspot use netsh cmd

All command is ok 

But only sharing option that i dont know how to control

That list all network for choice one network to share

Then set properties Sharing

post-81501-0-11614700-1420127246_thumb.p

I find any infomation about 2hour but i cant find anything

I thinking about control click but it will not right for all windows version

Please. Help me! Have you some ideas?

Link to comment
Share on other sites

I'd be willing to bet those settings are stored in the registry.  I'm not at a place where I can test this, but I'd recommend using procmon to see what registry keys are being set and try setting them via your autoit script.  It may take a disable/enable of the network interface for the changes to take effect.

Just my two cents

Link to comment
Share on other sites

  • Solution

Calm down. I see a vb6 example and ported to AutoIt. 

#RequireAdmin

Func EnableDisableICS($sPublicConnectionName,$ssPrivateConnectionName,$bEnable)

    Local  $bFound =False
    Dim $oNetSharingManager, $oConnectionCollection, $oItem, $EveryConnection, $objNCProps
    $oNetSharingManager = ObjCreate("HNetCfg.HNetShare.1")
    $oConnectionCollection = $oNetSharingManager.EnumEveryConnection
    For  $oItem In $oConnectionCollection
        $EveryConnection = $oNetSharingManager.INetSharingConfigurationForINetConnection($oItem)
        $objNCProps = $oNetSharingManager.NetConnectionProps($oItem)
        If $objNCProps.name = $ssPrivateConnectionName Then
            $bFound = True
;~             MsgBox(0,"","Starting Internet Sharing For: " & $objNCProps.name)
            If $bEnable Then
                $EveryConnection.EnableSharing(1)
            Else
                $EveryConnection.DisableSharing()
            EndIf
        EndIf
    Next
    $oConnectionCollection = $oNetSharingManager.EnumEveryConnection
    For  $oItem In $oConnectionCollection
        $EveryConnection = $oNetSharingManager.INetSharingConfigurationForINetConnection($oItem)
        $objNCProps = $oNetSharingManager.NetConnectionProps($oItem)
        If $objNCProps.name = $sPublicConnectionName Then
            $bFound = True
;~             MsgBox(0,"","Internet Sharing Success For: " & $objNCProps.name)
            If $bEnable Then
                $EveryConnection.EnableSharing(0)
            Else
                $EveryConnection.DisableSharing()
            EndIf
        EndIf
    Next
    Return $bFound
EndFunc


MsgBox(0,"",EnableDisableICS("YOUR ACTIVE NETWORK", "OUR ADAPTOR TO SHARE", True))
 

Saludos

.

Link to comment
Share on other sites

The code list all network here ($oConnectionCollection)  

You're wellcome. happy new year too.

if the topic is solved. mark as answered.

Saludos

Edited by Danyfirex
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...