Функция _Net_Share_ResourceStr

 ↑  ←  Описание функции


_Net_Share_ResourceStr

Returns the string representation of a resource

#include <NetShare.au3>
_Net_Share_ResourceStr($iResource)

Параметры

$iResource Resource type. Can be a combination of:
    $STYPE_DISKTREE - Print queue
    $STYPE_PRINTQ - Disk drive
    $STYPE_DEVICE - Communication device
    $STYPE_IPC - IPC
    $STYPE_SPECIAL - Special share reserved for IPC$ or remote administration of the server
    $STYPE_TEMPORARY - A temporary share

Возвращаемое значение

Returns a Resource type string

Пример

#include <GUIConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $sServer, $sShare, $aInfo

    ; Создаёт GUI
    $hGUI = GUICreate("NetShare", 400, 300)

    ; Создаёт элемент для заметок
    $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetState()

    ; Get server and share information
    $sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
    If @error Then Exit

    $sShare = InputBox("NetWork Demo", "Enter Share Name:", "MyShare", "", 200, 130)
    If @error Then Exit

    ; Enumerate network connections
    $aInfo = _Net_Share_ConnectionEnum ($sServer, $sShare)
    MemoWrite("Error ...................: " & @error)
    MemoWrite("Entries read ............: " & $aInfo[0][0])
    For $iI = 1 To $aInfo[0][0]
        MemoWrite("Connection ID ...........: " & $aInfo[$iI][0])
        MemoWrite("Connection type..........: " & _Net_Share_ResourceStr ($aInfo[$iI][1]))
        MemoWrite("Number of files open ....: " & $aInfo[$iI][2])
        MemoWrite("Number of users .........: " & $aInfo[$iI][3])
        MemoWrite("Connection time .........: " & $aInfo[$iI][4])
        MemoWrite("Username ................: " & $aInfo[$iI][5])
        MemoWrite("Network name ............: " & $aInfo[$iI][6])
        MemoWrite()
    Next


    ; Цикл выполняется, пока окно не будет закрыто
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main

; Записывает строку в элемент для заметок
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite