jxpxfeiw 发表于 2009-9-11 11:05:25

已解决

本帖最后由 jxpxfeiw 于 2009-9-11 14:49 编辑

#NoTrayIcon
Global Const $BS_FLAT = 0x8000
Global Const $CBS_AUTOHSCROLL = 0x40
Global Const $CBS_DROPDOWN = 0x2
Global Const $CBS_DROPDOWNLIST = 0x3
Global Const $CBS_UPPERCASE = 0x2000
Global Const $__COMBOBOXCONSTANT_WS_VSCROLL = 0x00200000
Global Const $GUI_SS_DEFAULT_COMBO = BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $__COMBOBOXCONSTANT_WS_VSCROLL)
Global Const $ES_CENTER = 1
Global Const $ES_AUTOVSCROLL = 64
Global Const $ES_AUTOHSCROLL = 128
Global Const $ES_READONLY = 2048
Global Const $ES_WANTRETURN = 4096
Global Const $__EDITCONSTANT_WS_VSCROLL = 0x00200000
Global Const $__EDITCONSTANT_WS_HSCROLL = 0x00100000
Global Const $GUI_SS_DEFAULT_EDIT = BitOR($ES_WANTRETURN, $__EDITCONSTANT_WS_VSCROLL, $__EDITCONSTANT_WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL)
Global Const $GUI_EVENT_CLOSE = -3
Global Const $GUI_CHECKED = 1
Global Const $GUI_UNCHECKED = 4
Global Const $GUI_ENABLE = 64
Global Const $GUI_DISABLE = 128
Global Const $GUI_DOCKALL = 0x0322
Global Const $WS_MINIMIZEBOX = 0x00020000
Global Const $WS_GROUP = 0x00020000
Global Const $WS_SYSMENU = 0x00080000
Global Const $WS_CAPTION = 0x00C00000
Global Const $WS_POPUP = 0x80000000
Global Const $GUI_SS_DEFAULT_GUI = BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU)
Func _RunDOS($sCommand)
Local $nResult = RunWait(@ComSpec & " /C " & $sCommand, "", @SW_HIDE)
Return SetError(@error, @extended, $nResult)
EndFunc
Global $NONEAACTIVECOLOR = 0x808080
Global $anymonSAM = RegRead('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa', 'restrictanonymoussam')
Global $SAM = RegRead('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa', 'restrictanonymous')
Global $network = RegRead('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa', 'forceguest')
Global $Firewall = RegRead('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile', 'EnableFirewall')
Local $Disable = '禁用', $Enable = '启用', $Access = "仅来宾-本地用户以来宾身份验证", $Mode = "经典-本地用户以自己的身份验证", $arry, $file, $name, $Button, $Label, $var, $Input2, $Combo
$Form1 = GUICreate("SchindlerShare Experts", 303, 221, -1, -1)
$Group1 = GUICtrlCreateGroup("一键快速共享", 8, 8, 289, 209)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
$Label = GUICtrlCreateLabel("请输入共享目录的绝对路径:", 16, 35, 160, 17)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetColor(-1, 0xFF0000)
$Input1 = GUICtrlCreateInput("", 16, 51, 241, 19, BitOR($ES_CENTER, $ES_READONLY))
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetColor(-1, $NONEAACTIVECOLOR)
$Label = GUICtrlCreateLabel("共享名", 16, 83, 40, 17)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetColor(-1, 0xFF0000)
$Label = GUICtrlCreateLabel("(可自定义):", 50, 83, 90, 17)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetColor(-1, 0xFF0000)
$Input2 = GUICtrlCreateInput("", 16, 104, 241, 19, BitOR($ES_CENTER, $ES_READONLY))
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetColor(-1, $NONEAACTIVECOLOR)
$Button = GUICtrlCreateButton(">>>", 264, 50, 25, 21, BitOR($BS_FLAT, $WS_GROUP))
GUICtrlSetResizing(-1, $GUI_DOCKALL)
$Checkbox2 = GUICtrlCreateCheckbox("此共享允许写入", 152, 128, 105, 17)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetColor(-1, 0x0000FF)
$Checkbox1 = GUICtrlCreateCheckbox("网络上隐藏此共享", 16, 129, 129, 17)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetState(-1, $GUI_DISABLE)
$Radio1 = GUICtrlCreateRadio("默认程序自动设置", 16, 160, 113, 17)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetState(-1, $GUI_CHECKED)
$Radio2 = GUICtrlCreateRadio("高级用户自定义", 152, 160, 113, 17)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetColor(-1, 0x0000FF)
$server = GUICtrlCreateButton("共享", 16, 186, 75, 22, BitOR($BS_FLAT, $WS_GROUP))
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetState(-1, $GUI_DISABLE)
$Clear = GUICtrlCreateButton("清空", 112, 186, 75, 22, BitOR($BS_FLAT, $WS_GROUP))
GUICtrlSetResizing(-1, $GUI_DOCKALL)
$Help = GUICtrlCreateButton("问题反馈", 208, 186, 75, 22, BitOR($BS_FLAT, $WS_GROUP))
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUISetState(@SW_SHOW)
HotKeySet('{F1}', 'delshare')
While 1
Local $run
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Radio2
$size = WinGetPos("")
If $size = 309 And $size = 246 Then
WinMove("SchindlerShare Experts", "",(@DesktopWidth - 500) / 2,(@DesktopHeight - 526) / 2, 500, 526)
$Group2 = GUICtrlCreateGroup("高级用户设置", 8, 232, 481, 265)
$Label = GUICtrlCreateLabel("网络访问:本地用户的共享模式:", 16, 256, 175, 17)
GUICtrlSetColor(-1, 0xFF0000)
$Combo = GUICtrlCreateCombo("", 272, 256, 209, 25, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, $Access & '|' & $Mode, "")
GUICtrlSetColor(-1, 0x0000FF)
$Label = GUICtrlCreateLabel("当前状态:", 16, 280, 64, 17)
GUICtrlSetColor(-1, 0x808080)
$Label = GUICtrlCreateLabel("仅来宾-本地用户以来宾身份验证", 80, 280, 175, 17)
GUICtrlSetColor(-1, 0x808080)
If $network = 0 Then
GUICtrlSetData($Label, '经典-本地用户以自己的身份验证')
Else
GUICtrlSetData($Label, '仅来宾-本地用户以来宾身份验证')
EndIf
$Label = GUICtrlCreateLabel("网络访问:不允许 SAM 帐户匿名枚举:", 16, 304, 204, 17)
GUICtrlSetColor(-1, 0xFF0000)
$Combo = GUICtrlCreateCombo("", 272, 304, 209, 25, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, $Enable & '|' & $Disable, "")
GUICtrlSetColor(-1, 0x0000FF)
$Label = GUICtrlCreateLabel("当前状态:", 16, 328, 64, 17)
GUICtrlSetColor(-1, 0x808080)
$Label = GUICtrlCreateLabel("", 80, 328, 28, 17)
GUICtrlSetColor(-1, 0x808080)
If $anymonSAM = 0 Then
GUICtrlSetData($Label, '禁用')
Else
GUICtrlSetData($Label, '启用')
EndIf
$Label = GUICtrlCreateLabel("网络访问:不允许 SAM 帐户和共享的匿名枚举:", 16, 352, 252, 17)
GUICtrlSetColor(-1, 0xFF0000)
$Combo = GUICtrlCreateCombo("", 272, 352, 209, 25, BitOR($CBS_UPPERCASE, $CBS_DROPDOWNLIST))
GUICtrlSetData(-1, $Enable & '|' & $Disable, "")
GUICtrlSetColor(-1, 0x0000FF)
$Label = GUICtrlCreateLabel("当前状态:", 16, 376, 64, 17)
GUICtrlSetColor(-1, 0x808080)
$Label = GUICtrlCreateLabel("", 80, 376, 28, 17)
GUICtrlSetColor(-1, 0x808080)
If $SAM = 0 Then
GUICtrlSetData($Label, '禁用')
Else
GUICtrlSetData($Label, '启用')
EndIf
$Label = GUICtrlCreateLabel("Guest用户:", 16, 400, 68, 17)
GUICtrlSetColor(-1, 0xFF0000)
$Combo = GUICtrlCreateCombo("", 96, 400, 81, 25, BitOR($CBS_UPPERCASE, $CBS_DROPDOWNLIST))
GUICtrlSetData(-1, $Enable & '|' & $Disable, "")
GUICtrlSetColor(-1, 0x0000FF)
$Label = GUICtrlCreateLabel("当前状态:", 16, 424, 64, 17)
GUICtrlSetColor(-1, 0x808080)
$Label = GUICtrlCreateLabel("error", 80, 424, 28, 17)
GUICtrlSetColor(-1, 0x808080)
$Label = GUICtrlCreateLabel("防火墙设置:", 16, 448, 76, 17)
GUICtrlSetColor(-1, 0xFF0000)
$Combo = GUICtrlCreateCombo("", 96, 448, 81, 25, BitOR($CBS_UPPERCASE, $CBS_DROPDOWNLIST))
GUICtrlSetData(-1, $Enable & '|' & $Disable, "")
GUICtrlSetColor(-1, 0x0000FF)
$Label = GUICtrlCreateLabel("当前状态:", 16, 472, 64, 17)
GUICtrlSetColor(-1, 0x808080)
$Label = GUICtrlCreateLabel("", 80, 472, 76, 17)
GUICtrlSetColor(-1, 0x808080)
If $Firewall = 0 Then
GUICtrlSetData($Label, '防火墙已关闭')
Else
GUICtrlSetData($Label, '防火墙已开启')
EndIf
$run = GUICtrlCreateButton("应 用 设 置", 352, 432, 131, 57, $BS_FLAT)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label = GUICtrlCreateLabel("SchindlerSharing Experts", 310, 16, 190, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label = GUICtrlCreateLabel(@CRLF & "设置提示:" & @CRLF & '不推荐你使用高级用户自定义设置,对于不太了解共享的人来说,错误的设置可能会导致共享不能访问,建议你使用程序默认设置。' & @CRLF & @CRLF & @CRLF & @CRLF & '安全提示:' & @CRLF & '不推荐选中(允许用户写入),因为可能导致局域网病毒传播,最终影响用户的使用。', 312, 40, 174, 177)
GUICtrlSetColor(-1, 0xFF0000)
EndIf
Case $Radio1
GUICtrlDelete($Group2)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($Label)
GUICtrlDelete($run)
GUICtrlDelete($Combo)
GUICtrlDelete($Combo)
GUICtrlDelete($Combo)
GUICtrlDelete($Combo)
GUICtrlDelete($Combo)
WinMove("SchindlerShare Experts", "",(@DesktopWidth - 309) / 2,(@DesktopHeight - 254) / 2, 309, 246)
Case $Button
$file = FileSelectFolder("请选择需要共享的目录", '', 7)
GUICtrlSetData($Input1, $file)
If StringLen($file) = 3 Then
$var = StringLeft($file, 1)
GUICtrlSetData($Input2, $var)
Else
$arry = StringSplit($file, '\', 1)
For $i = 1 To $arry
$name = $arry
GUICtrlSetData($Input2, $arry[$name])
Next
EndIf
If GUICtrlRead($Input1) > "" Then
GUICtrlSetState($server, $GUI_ENABLE)
GUICtrlSetStyle($Input2, $ES_CENTER)
GUICtrlSetState($Checkbox1, $GUI_ENABLE)
Else
GUICtrlSetState($server, $GUI_DISABLE)
GUICtrlSetStyle($Input2, $ES_READONLY)
GUICtrlSetState($Checkbox1, $GUI_DISABLE)
EndIf
Case $Checkbox1
If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
GUICtrlSetData($Input2, GUICtrlRead($Input2) & '$')
GUICtrlSetData($Label, '(不可自定义):')
GUICtrlSetStyle($Input2, BitOR($ES_CENTER, $ES_READONLY))
ElseIf StringLen($file) = 3 Then
GUICtrlSetData($Input2, $var)
GUICtrlSetData($Label, '(可自定义):')
GUICtrlSetStyle($Input2, $ES_CENTER)
Else
GUICtrlSetData($Input2, $arry[$name])
GUICtrlSetStyle($Input2, $ES_CENTER)
GUICtrlSetData($Label, '(可自定义):')
EndIf
Case $server
yincan()
Case $Clear
GUICtrlSetData($Input1, '')
GUICtrlSetData($Input2, '')
GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox2, $GUI_UNCHECKED)
GUICtrlSetState($server, $GUI_DISABLE)
GUICtrlSetState($Checkbox1, $GUI_DISABLE)
Case $Help
_RunDOS('start tencent://Message/?Uin=670414974')
Case $run
MsgBox(64, '11', '22')
EndSwitch
WEnd
Func yincan()
Global $Srvname = GUICtrlRead($Input2)
Global $Srvpatch = GUICtrlRead($Input1)
If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
RunWait(@ComSpec & ' /c net share ' & $Srvname & '=' & $Srvpatch & ' ' & '/unlimited', '', @SW_HIDE)
Else
RunWait(@ComSpec & ' /c net share ' & $Srvname & '=' & $Srvpatch, '', @SW_HIDE)
EndIf
EndFunc
Func delshare()
If GUICtrlRead($Input2) = '' Then
MsgBox(64, '提示', '共享不存在')
Else
RunWait(@ComSpec & ' /c net share ' & GUICtrlRead($Input2) & ' /delete /y', '', @SW_HIDE)
MsgBox(64, '提示', '当前共享已取消')
EndIf
EndFunc

afan 发表于 2009-9-11 11:18:46

应该是你出了什么问题,这样让人猜,这么长,估计人家想帮都望而却步

jxpxfeiw 发表于 2009-9-11 11:24:49

本帖最后由 jxpxfeiw 于 2009-9-11 11:26 编辑

2# afan
我也不好怎么说,具体的你测试下就应该知道了 能把你QQ告诉我不

afan 发表于 2009-9-11 11:25:19

我早望而却步了

jxpxfeiw 发表于 2009-9-11 11:29:30

算了 表达能力有限!自己琢磨吧
页: [1]
查看完整版本: 已解决