Crome_BAD Posted August 2, 2007 Share Posted August 2, 2007 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.. Link to comment Share on other sites More sharing options...
Zedna Posted August 3, 2007 Share Posted August 3, 2007 Post your code.Also look at sources and examples of _NetShare_ShareCheck() in Auto3LibFor 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. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Crome_BAD Posted August 3, 2007 Author Share Posted August 3, 2007 Post your code. Also look at sources and examples of _NetShare_ShareCheck() in Auto3Lib For example mind this: expandcollapse popup;----------- ; 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. Link to comment Share on other sites More sharing options...
Zedna Posted August 3, 2007 Share Posted August 3, 2007 Try this: $ret = Check("C:\") MsgBox(0,'Result of Check',$ret) Func Check($sName) Return _NetShare_ShareCheck("", $sName) ; or "\\127.0.0.1" EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now