Sign in to follow this  
Followers 0
kid1232

Need help about Network sharing

6 posts in this topic

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?

Share this post


Link to post
Share on other sites



Hi. Any one can help me please?

Share this post


Link to post
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

1 person likes this

Share this post


Link to post
Share on other sites

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

.

1 person likes this

Share this post


Link to post
Share on other sites

Jaaaaaa

Thx @Danyfirex

Your code work perfect!!!!!

Now i will trying to find how to list all network now my idea is ok

Thanks every body so much

You are the best :D

And. Happy new year, man! xD

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • badcoder123
      By badcoder123
      Anyone know how to access the information circled in the photo?
       

    • robcull
      By robcull
      Hello all! I have had some issues reading text from different types of windows, occasionally, specifically with controlgettext. 
      **Before I begin, I know there are better ways to do what I attempt in the example below. That's not the point of this post. The point is my issues with controlgettext. 
      I am about to cite an example with an application you may be familiar with called SpeedFan (v4.52). My problem is not specific to speedfan, it is simply the most recent and easily reproducible example I can think of. 
      So, the goal of the script below is to get a string of text containing the current fan RPMs from the highlighted control in the screenshot below (see "speedfan_control_details.png").

      Now, here's a simple script for grabbing the window handle and reading the text from that control: 
      $wintitle = "SpeedFan 4.52" $controlID = "197934" ;will be reformatted as "[ID:######]" $hwnd = wingethandle($wintitle) if @error<>0 then msgbox(0, "WinGetHandle", "FAILURE. @error="&@error) Exit EndIf $text = ControlGetText($hwnd, "", "[ID:"&$controlID&"]") if @error=1 then msgbox(0, "ControlGetText", "FAILURE. @error="&@error) ;failure returns "" and @error=1 Exit EndIf msgbox (0, "ControlGetText", "SUCCESS. @error="&@error &@CRLF& "$text="&$text) ;success returns string and @error=0 You'll see that the ControlGetText operation runs without error, however it does not capture any text from the control. If you explore the other controls in this one window, you'll find mixed results across the board. Neither the temps nor voltages can be read, while the log field and some other elements can be read. Even when you read the text from the whole window, those elements are not included in the visible nor hidden texts. 
       
      I have run into this issue many times in the past- inconsistencies in the ability of autoit to interact with certain controls. What is it which makes this text different than any other readable texts? Is there an alternate method of reading the text in the window/control which could work? Any and all info to help me solve this mystery and satisfy my curiosity would be greatly appreciated. 
      Thanks  -Rob C
      PS: Running Autoit v3.3.14.2 on Win7 Ultimate x64
    • Nareshm
      By Nareshm
      How can i add sleep command using internet speed.
      If my internet speed is 40-50Kbps then sleep for 5 seconds,
      If my internet speed is 30-40Kbps then sleep for 4 seconds,
      If my internet speed is 20-30Kbps then sleep for 3 seconds.

      *Sleep command used bitween my costom script, Example,
      RunWait("rasdial /disconnect", "", @SW_HIDE) ; Stop connect from start
      Sleep(5000)
      RunWait("rasdial Internet", "", @SW_HIDE) ; Connect again
       
    • Nareshm
      By Nareshm
      Please Somebody Help me i am trying to create new script but, i don't know how to create it.

      I am Creating script like this :
      ; My script here [First Script]
      Check the internet connection, if internet connected then
      ; My Script here [Second Script]
      If internet not connected, wait for connect, after connected run my second script
      If Control id/windows/title matched do nothing and end/exit autoit script
      If Control id/windows/title not matched repeat my first and second script again until control id/windows/tittle not matched

      match with :
      >>>> Window <<<<
      Title:    PS :: Version - 2.8.0.0  - [PS Bill]
      Class:    WindowsForm734a
      Position:    -8, -8
      Size:    1382, 744
      Style:    0x17CD0000
      ExStyle:    0x00050100
      Handle:    0x0000000000130572
      >>>> Control <<<<
      Class:    WindowsForm734a
      Instance:    15
      ClassnameNN:    WindowsForm34a15
      Name:    BillPrint
      Advanced (Class):    [NAME:BillPrint]
      ID:    7875
      Text:    
      Position:    39, 310
      Size:    1221, 306
      ControlClick Coords:    745, 20
      Style:    0x56010000
      ExStyle:    0x00000000
      Handle:    0x00000000000C0468
       
    • Skeletor
      By Skeletor
      Hi Guys, 
      So with me working in my Virtual Machines in full screen, I often have my Host OS playing music. Now the issue I had was trying to control the Host OS without having to minimise the Guest OS.
      So I thought of this small program. I call it the Volume Control. It resides in the bottom right hand corner of your screen just above the system clock. 
      I'm still working on getting the volume buttons to increase/decrease when you hold down the button.
      Currently, you will need to tap on the volume buttons numerous times to decrease/increase the volume. 
      Any other improvements let me know. 
      The source code, icon and compiled program are already in the zip. 
       

       
      Volume Controlv1.zip
      Screenshot.bmp