Sign in to follow this  
Followers 0
Crome_BAD

A3LNetShare.au3 question...

4 posts in this topic

Hey guys, im trying to make a share program, because with my network, its hard to tell other how to do it. So, i thought id make a program that they could do on there own.

My question: _NetShare_ShareCheck returns -1 regardless of what i put in! EVEN if i put in a already used name. Am i missing something? I can put the code in if its needed. Im just stumped as to why it returns -1 all the time..

Share this post


Link to post
Share on other sites



Post your code.

Also look at sources and examples of _NetShare_ShareCheck() in Auto3Lib

For example mind this:

; Remarks .......: Only members of the Administrators, System Operators, or Power Users local group can add file shares with a

; call to this function. The Print Operator can add printer shares.

Share this post


Link to post
Share on other sites

Post your code.

Also look at sources and examples of _NetShare_ShareCheck() in Auto3Lib

For example mind this:

;-----------
; Include
;-----------

#include <A3LNetShare.au3>
#include <GUIConstants.au3>

;-----------
; Globals
;-----------

Global $Tab[2]
Global $Input[2]
Global $Button[2]
Global $hwnd[3]

$hwnd[1] = 300
$hwnd[2] = 150

;-----------
; GUI
;-----------

$hwnd[0] = GUICreate("Brians NetShare v0.1", $hwnd[1], $hwnd[2])

GUICtrlCreateTab(5, 5, 290, ($hwnd[2] - 10))
    $Tab[0] = GUICtrlCreateTabItem("Share")
        $Input[0] = GUICtrlCreateInput("", 15, 35, 200, 20)
        $Input[1] = GUICtrlCreateInput("Share Name Here", 15, 65, 200, 20)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Button[0] = GUICtrlCreateButton("Browse..", 220, 35, 60, 20)
        $Button[1] = GUICtrlCreateButton("Share!", 95, 110, 100, 20)

GUISetState()

While 1
    
    Sleep(10)

    $GUIMsg = GUIGetMsg()
    
    Select
        Case $GUIMsg = -3
            Exit
            
        Case $GUIMsg = $Button[0]
            SelectFolder()
            
        Case $GUIMsg = $Button[1]
            Check(GUICtrlRead($Input[1]))
            CreateShare(GUICtrlRead($Input[1]), GUICtrlRead($Input[0]))
            
    EndSelect
    
WEnd

;-----------
; Functions
;-----------

Func Check($sName)
    
    $Check = _NetShare_ShareCheck(@ComputerName, $sName)
    
EndFunc

Func CreateShare($sName, $sDir)
    
    $sInfo = _NetShare_ShareAdd(@ComputerName, $sName, 0, $sDir)
    
EndFunc

Func SelectFolder()
    
    $TextInput = FileSelectFolder("Select Folder To Share...", "C:\")
    GUICtrlSetData($Input[0], $TextInput)
    GUICtrlSetState($Input[1], $GUI_ENABLE)
    
EndFunc

There it is, Im still unsure as to why, and i am running under admin of the computer.

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