Êîìïüþòåðíûé ôîðóì OSzone.net  

Êîìïüþòåðíûé ôîðóì OSzone.net (http://forum.oszone.net/index.php)
-   AutoIt (http://forum.oszone.net/forumdisplay.php?f=103)
-   -   [ðåøåíî] Íå îòðàáàòûâàåò êíîïêà "Îáíîâèòü" ó ñêðèïòà (http://forum.oszone.net/showthread.php?t=185031)

saavaage 09-09-2010 12:11 1491662

Íå îòðàáàòûâàåò êíîïêà "Îáíîâèòü" ó ñêðèïòà
 
Âëîæåíèé: 1
Ñîáñòâåííî, ïðîáëåìû:
1. íå ïðîèñõîäèò îáíîâëåíèå ñïèñêà îáîðóäîâàíèÿ áåç äðàéâåðîâ ïðè íàæàòèè íà êíîïêó "Îáíîâèòü". Ïîëÿ ListView è TreeView î÷èùàþòñÿ, à èõ ïîâòîðíîå çàïîëíåíèå ñïèñêîì îáîðóäîâàíèÿ íå ïðîèñõîäèò.

Êîä:

÷èòàòü äàëüøå »
Êîä:

#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <TreeViewConstants.au3>
#Include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <GuiImageList.au3>
#include "DeviceAPI.au3"

Global $aAssoc[1][2]

$GUI = GUICreate("Device Management API - GUI Example", 800, 500)
$Refresh_Button = GUICtrlCreateButton("Îáíîâèòü", 705, 465, 85, 33)
Dim $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)
$hTreeView = _GUICtrlTreeView_Create($GUI, 5, 5, 300, 450, $iStyle, $WS_EX_STATICEDGE )
$hListView = GUICtrlCreateListView ("Key|Value", 310, 5, 485,450)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
_BuildListDevice()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Refresh_Button
            GUICtrlSetState($Refresh_Button, $GUI_DISABLE)
            _GUICtrlTreeView_DeleteAll($hTreeView)
            _GUICtrlListView_DeleteAllItems($hListView)
            sleep(1000)
            _BuildListDevice()
            sleep(1000)
            GUICtrlSetState($Refresh_Button, $GUI_ENABLE)
    EndSwitch
WEnd

Func _BuildListDevice()
    ;Assign image list to treeview
  _GUICtrlTreeView_SetNormalImageList($hTreeView, _DeviceAPI_GetClassImageList())

  Dim $total_devices = 0

  _DeviceAPI_GetClasses()

  While _DeviceAPI_EnumClasses()

    ;Get icon index from image list for given class
    $Icon_Index = _DeviceAPI_GetClassImageIndex($p_currentGUID)

    ;Build list of devices within current class, if class doesn't contain any devices it will be skipped

    _DeviceAPI_GetClassDevices($p_currentGUID)

    ;Skip classes without devices or devices have  drivers
    If _DeviceAPI_GetDeviceCount() > 0 and _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DRIVER) = '' Then


        ;Add parent class to treeview
        $parent = _GUICtrlTreeView_Add($hTreeView, 0, _DeviceAPI_GetClassDescription($p_currentGUID), $Icon_Index, $Icon_Index)

        ;Loop through all devices by index
        While _DeviceAPI_EnumDevices()

            $description = _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DEVICEDESC)
            $friendly_name = _DeviceAPI_GetDeviceRegistryProperty($SPDRP_FRIENDLYNAME)

            ;If a friendly name is available, use it instead of description
            If $friendly_name <> "" Then
              $description = $friendly_name
            EndIf


            ;Add device to treeview below parent
            $handle = _GUICtrlTreeView_AddChild($hTreeView, $parent, $description, $Icon_Index, $Icon_Index)

            If $total_devices > 0 Then
                ReDim $aAssoc[$total_devices+1][2]
            EndIf

            ;Add treeview item handle to array along with device Unique Instance Id (For lookup)
            $aAssoc[$total_devices][0] = $handle
            $aAssoc[$total_devices][1] = _DeviceAPI_GetDeviceId()

            ;Update running total count of devices
            $total_devices += 1
        WEnd
    EndIf
  WEnd

EndFunc

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview

    $hWndTreeview = $hTreeView
    If Not IsHWnd($hTreeView) Then $hWndTreeview = GUICtrlGetHandle($hTreeView)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndTreeview
            Switch $iCode
                Case $TVN_SELCHANGEDA, $TVN_SELCHANGEDW
                    RefreshDeviceProperties()
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_NOTIFY

;Triggered when a device is selected in the treeview
Func RefreshDeviceProperties()
    Local $hSelected = _GUICtrlTreeView_GetSelection($hTreeView)

    ;Don't do anything if a class name (root item) was clicked
    If _GUICtrlTreeView_Level($hTreeView, $hSelected) = 0 Then Return

    ;Lookup treeview item handle in global array
    For $X = 0 to Ubound($aAssoc)-1

        If $hSelected = $aAssoc[$X][0] Then
            ;MsgBox(0,"", "Handle: " & $aAssoc[$X][0] & @CRLF & "Unique Instance Id: " & $aAssoc[$X][1])

            ;Build list of ALL device classes
            _DeviceAPI_GetClassDevices()

            ;Loop through all devices by index
            While _DeviceAPI_EnumDevices()
                If $aAssoc[$X][1] = _DeviceAPI_GetDeviceId() Then

                    ;Empty listview
                    _GUICtrlListView_DeleteAllItems($hListView)

                    GUICtrlCreateListViewItem ("Hardware ID: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_HARDWAREID), $hListView )
                    GUICtrlCreateListViewItem ("Unique Instance ID: |" & _DeviceAPI_GetDeviceId(), $hListView )
                    GUICtrlCreateListViewItem ("Manufacturer: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_MFG), $hListView )
                    GUICtrlCreateListViewItem ("Driver: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DRIVER), $hListView )
                    GUICtrlCreateListViewItem ("Friendly Name: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_FRIENDLYNAME), $hListView )
                    GUICtrlCreateListViewItem ("Physical Device Object Name: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_PHYSICAL_DEVICE_OBJECT_NAME), $hListView )
                    GUICtrlCreateListViewItem ("Upper Filters: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_UPPERFILTERS), $hListView )
                    GUICtrlCreateListViewItem ("Lower Filters: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_LOWERFILTERS), $hListView )
                    GUICtrlCreateListViewItem ("Enumerator: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_ENUMERATOR_NAME), $hListView )

                    ;Resize columns to fit text
                    _GUICtrlListView_SetColumnWidth($hListView, 0,$LVSCW_AUTOSIZE)
                    _GUICtrlListView_SetColumnWidth($hListView, 1,$LVSCW_AUTOSIZE)
                EndIf
            WEnd
        EndIf
    Next
EndFunc

;Cleanup image list
_DeviceAPI_DestroyClassImageList()
_DeviceAPI_DestroyDeviceInfoList() ;Cleanup for good measure



PS åñëè ó Âàñ âñå äðàéâåðà ñòîÿò, òî ïðîâåðèòü ðàáîòó ñêðèïòà ìîæíî, çàìåíèâ ñòðîêó
Êîä:
Êîä:

If _DeviceAPI_GetDeviceCount() > 0 and _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DRIVER) = '' Then
íà
Êîä:
Êîä:

If _DeviceAPI_GetDeviceCount() > 0  Then
2. Ïî÷åìó-òî ñ ôóíêöèåé DeviceAPI.au3 íåêîðåêòíî îòðàáàòûâàåò Organize Includes ( http://www.autoitscript.com/forum/in...owtopic=111554 )

PS âåðñèÿ autoit 3.3.6.1 Íåîáõîäèìà ôóíêöèÿ DeviceAPI.au3 (ñì. àðõèâ)

Creat0R 09-09-2010 19:53 1491990

http://autoit-script.ru/index.php/to....html#msg19029

saavaage 09-09-2010 23:14 1492122

Òåìà ðåøåíà. Íà âñÿêèé ñëó÷àé, âûêëàäûâàþ êîä, ïðåäîñòàâëåííûé Creat0R:
÷èòàòü äàëüøå »
Êîä:

#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <TreeViewConstants.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <GuiImageList.au3>
#include "DeviceAPI.au3"

Global $aAssoc[1][2]

$GUI = GUICreate("Device Management API - GUI Example", 800, 500)
$Refresh_Button = GUICtrlCreateButton("Îáíîâèòü", 705, 465, 85, 33)
Dim $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)
$hTreeView = _GUICtrlTreeView_Create($GUI, 5, 5, 300, 450, $iStyle, $WS_EX_STATICEDGE)
$hListView = GUICtrlCreateListView("Key|Value", 310, 5, 485, 450)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
_BuildListDevice()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Refresh_Button
            GUICtrlSetState($Refresh_Button, $GUI_DISABLE)
           
            _GUICtrlTreeView_DeleteAll($hTreeView)
            _GUICtrlListView_DeleteAllItems($hListView)
           
            Dim $aAssoc[1][2]
           
            _DeviceAPI_ResetLibrary()
            _BuildListDevice()
           
            GUICtrlSetState($Refresh_Button, $GUI_ENABLE)
    EndSwitch
WEnd

;Cleanup image list
_DeviceAPI_DestroyClassImageList()
_DeviceAPI_DestroyDeviceInfoList() ;Cleanup for good measure

Func _DeviceAPI_ResetLibrary()
    $hDevInfo = ""
   
    $aGUID = 0 ;Handle to GUID array structure
    $paGUID = DllStructGetPtr($aGUID) ;Pointer to GUID array structure
    $p_currentGUID = 0 ;Pointer to specific element in GUID array structure
   
    ;Create an SP_DEVINFO_DATA structure
    $DEVINFO_DATA = _DeviceAPI_CreateDeviceDataStruct()
    $pSP_DEVINFO_DATA = DllStructGetPtr($DEVINFO_DATA) ;Get pointer to previous structure
   
    ;Create SP_CLASSIMAGELIST_DATA structure
    $SP_CLASSIMAGELIST_DATA = _DeviceAPI_CreateClassImageListStruct()
    $pSP_CLASSIMAGELIST_DATA = DllStructGetPtr($SP_CLASSIMAGELIST_DATA) ;Get pointer to previous structure
   
    $iEnumClassInfoCursor = 0
    $iEnumDeviceInfoCursor = 0
EndFunc

Func _BuildListDevice()
    ;Assign image list to treeview
    _GUICtrlTreeView_SetNormalImageList($hTreeView, _DeviceAPI_GetClassImageList())

    Dim $total_devices = 0
   
    _DeviceAPI_GetClasses()
   
    While _DeviceAPI_EnumClasses()
        ;Get icon index from image list for given class
        $Icon_Index = _DeviceAPI_GetClassImageIndex($p_currentGUID)
       
        ;Build list of devices within current class, if class doesn't contain any devices it will be skipped
        _DeviceAPI_GetClassDevices($p_currentGUID)
       
        ;Skip classes without devices or devices have  drivers
        If _DeviceAPI_GetDeviceCount() > 0 And _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DRIVER) = '' Then
            ;Add parent class to treeview
            $parent = _GUICtrlTreeView_Add($hTreeView, 0, _DeviceAPI_GetClassDescription($p_currentGUID), $Icon_Index, $Icon_Index)

            ;Loop through all devices by index
            While _DeviceAPI_EnumDevices()
                $description = _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DEVICEDESC)
                $friendly_name = _DeviceAPI_GetDeviceRegistryProperty($SPDRP_FRIENDLYNAME)

                ;If a friendly name is available, use it instead of description
                If $friendly_name <> "" Then
                    $description = $friendly_name
                EndIf


                ;Add device to treeview below parent
                $handle = _GUICtrlTreeView_AddChild($hTreeView, $parent, $description, $Icon_Index, $Icon_Index)

                If $total_devices > 0 Then
                    ReDim $aAssoc[$total_devices + 1][2]
                EndIf
               
                ;Add treeview item handle to array along with device Unique Instance Id (For lookup)
                $aAssoc[$total_devices][0] = $handle
                $aAssoc[$total_devices][1] = _DeviceAPI_GetDeviceId()

                ;Update running total count of devices
                $total_devices += 1
            WEnd
        EndIf
    WEnd
EndFunc  ;==>_BuildListDevice

;Triggered when a device is selected in the treeview
Func RefreshDeviceProperties()
    Local $hSelected = _GUICtrlTreeView_GetSelection($hTreeView)

    ;Don't do anything if a class name (root item) was clicked
    If _GUICtrlTreeView_Level($hTreeView, $hSelected) = 0 Then Return

    ;Lookup treeview item handle in global array
    For $X = 0 To UBound($aAssoc) - 1

        If $hSelected = $aAssoc[$X][0] Then
            ;MsgBox(0,"", "Handle: " & $aAssoc[$X][0] & @CRLF & "Unique Instance Id: " & $aAssoc[$X][1])

            ;Build list of ALL device classes
            _DeviceAPI_GetClassDevices()

            ;Loop through all devices by index
            While _DeviceAPI_EnumDevices()
                If $aAssoc[$X][1] = _DeviceAPI_GetDeviceId() Then

                    ;Empty listview
                    _GUICtrlListView_DeleteAllItems($hListView)

                    GUICtrlCreateListViewItem("Hardware ID: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_HARDWAREID), $hListView)
                    GUICtrlCreateListViewItem("Unique Instance ID: |" & _DeviceAPI_GetDeviceId(), $hListView)
                    GUICtrlCreateListViewItem("Manufacturer: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_MFG), $hListView)
                    GUICtrlCreateListViewItem("Driver: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DRIVER), $hListView)
                    GUICtrlCreateListViewItem("Friendly Name: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_FRIENDLYNAME), $hListView)
                    GUICtrlCreateListViewItem("Physical Device Object Name: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_PHYSICAL_DEVICE_OBJECT_NAME), $hListView)
                    GUICtrlCreateListViewItem("Upper Filters: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_UPPERFILTERS), $hListView)
                    GUICtrlCreateListViewItem("Lower Filters: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_LOWERFILTERS), $hListView)
                    GUICtrlCreateListViewItem("Enumerator: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_ENUMERATOR_NAME), $hListView)

                    ;Resize columns to fit text
                    _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE)
                    _GUICtrlListView_SetColumnWidth($hListView, 1, $LVSCW_AUTOSIZE)
                EndIf
            WEnd
        EndIf
    Next
EndFunc  ;==>RefreshDeviceProperties

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview

    $hWndTreeview = $hTreeView
    If Not IsHWnd($hTreeView) Then $hWndTreeview = GUICtrlGetHandle($hTreeView)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndTreeview
            Switch $iCode
                Case $TVN_SELCHANGEDA, $TVN_SELCHANGEDW
                    RefreshDeviceProperties()
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_NOTIFY



ëèáî òàêîé êîä (íå óâåðåí, ÷òî ïðàâèëüíî ïîíÿë ìûñëü Creat0R, íî ó ìåíÿ îí ðàáîòàåò)

÷èòàòü äàëüøå »
Êîä:

#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <TreeViewConstants.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <GuiImageList.au3>
#include "DeviceAPI.au3"

Global $aAssoc[1][2]

$GUI = GUICreate("Device Management API - GUI Example", 800, 500)
$Refresh_Button = GUICtrlCreateButton("Îáíîâèòü", 705, 465, 85, 33)
Dim $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)
$hTreeView = _GUICtrlTreeView_Create($GUI, 5, 5, 300, 450, $iStyle, $WS_EX_STATICEDGE)
$hListView = GUICtrlCreateListView("Key|Value", 310, 5, 485, 450)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
_BuildListDevice()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Refresh_Button
            GUICtrlSetState($Refresh_Button, $GUI_DISABLE)
            $iEnumClassInfoCursor = 0
            $iEnumDeviceInfoCursor = 0
            _GUICtrlTreeView_DeleteAll($hTreeView)
            _GUICtrlListView_DeleteAllItems($hListView)

            _BuildListDevice()

            GUICtrlSetState($Refresh_Button, $GUI_ENABLE)
    EndSwitch
WEnd

;Cleanup image list
_DeviceAPI_DestroyClassImageList()
_DeviceAPI_DestroyDeviceInfoList() ;Cleanup for good measure


Func _BuildListDevice()
    ;Assign image list to treeview
    _GUICtrlTreeView_SetNormalImageList($hTreeView, _DeviceAPI_GetClassImageList())

    Dim $total_devices = 0

    _DeviceAPI_GetClasses()

    While _DeviceAPI_EnumClasses()
        ;Get icon index from image list for given class
        $Icon_Index = _DeviceAPI_GetClassImageIndex($p_currentGUID)

        ;Build list of devices within current class, if class doesn't contain any devices it will be skipped
        _DeviceAPI_GetClassDevices($p_currentGUID)

        ;Skip classes without devices or devices have  drivers
        If _DeviceAPI_GetDeviceCount() > 0 And _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DRIVER) <> '' Then
            ;Add parent class to treeview
            $parent = _GUICtrlTreeView_Add($hTreeView, 0, _DeviceAPI_GetClassDescription($p_currentGUID), $Icon_Index, $Icon_Index)

            ;Loop through all devices by index
            While _DeviceAPI_EnumDevices()
                $description = _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DEVICEDESC)
                $friendly_name = _DeviceAPI_GetDeviceRegistryProperty($SPDRP_FRIENDLYNAME)

                ;If a friendly name is available, use it instead of description
                If $friendly_name <> "" Then
                    $description = $friendly_name
                EndIf


                ;Add device to treeview below parent
                $handle = _GUICtrlTreeView_AddChild($hTreeView, $parent, $description, $Icon_Index, $Icon_Index)

                If $total_devices > 0 Then
                    ReDim $aAssoc[$total_devices + 1][2]
                EndIf

                ;Add treeview item handle to array along with device Unique Instance Id (For lookup)
                $aAssoc[$total_devices][0] = $handle
                $aAssoc[$total_devices][1] = _DeviceAPI_GetDeviceId()

                ;Update running total count of devices
                $total_devices += 1
            WEnd
        EndIf
    WEnd
EndFunc  ;==>_BuildListDevice

;Triggered when a device is selected in the treeview
Func RefreshDeviceProperties()
    Local $hSelected = _GUICtrlTreeView_GetSelection($hTreeView)

    ;Don't do anything if a class name (root item) was clicked
    If _GUICtrlTreeView_Level($hTreeView, $hSelected) = 0 Then Return

    ;Lookup treeview item handle in global array
    For $X = 0 To UBound($aAssoc) - 1

        If $hSelected = $aAssoc[$X][0] Then
            ;MsgBox(0,"", "Handle: " & $aAssoc[$X][0] & @CRLF & "Unique Instance Id: " & $aAssoc[$X][1])

            ;Build list of ALL device classes
            _DeviceAPI_GetClassDevices()

            ;Loop through all devices by index
            While _DeviceAPI_EnumDevices()
                If $aAssoc[$X][1] = _DeviceAPI_GetDeviceId() Then

                    ;Empty listview
                    _GUICtrlListView_DeleteAllItems($hListView)

                    GUICtrlCreateListViewItem("Hardware ID: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_HARDWAREID), $hListView)
                    GUICtrlCreateListViewItem("Unique Instance ID: |" & _DeviceAPI_GetDeviceId(), $hListView)
                    GUICtrlCreateListViewItem("Manufacturer: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_MFG), $hListView)
                    GUICtrlCreateListViewItem("Driver: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DRIVER), $hListView)
                    GUICtrlCreateListViewItem("Friendly Name: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_FRIENDLYNAME), $hListView)
                    GUICtrlCreateListViewItem("Physical Device Object Name: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_PHYSICAL_DEVICE_OBJECT_NAME), $hListView)
                    GUICtrlCreateListViewItem("Upper Filters: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_UPPERFILTERS), $hListView)
                    GUICtrlCreateListViewItem("Lower Filters: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_LOWERFILTERS), $hListView)
                    GUICtrlCreateListViewItem("Enumerator: |" & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_ENUMERATOR_NAME), $hListView)

                    ;Resize columns to fit text
                    _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE)
                    _GUICtrlListView_SetColumnWidth($hListView, 1, $LVSCW_AUTOSIZE)
                EndIf
            WEnd
        EndIf
    Next
EndFunc  ;==>RefreshDeviceProperties

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview

    $hWndTreeview = $hTreeView
    If Not IsHWnd($hTreeView) Then $hWndTreeview = GUICtrlGetHandle($hTreeView)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndTreeview
            Switch $iCode
                Case $TVN_SELCHANGEDA, $TVN_SELCHANGEDW
                    RefreshDeviceProperties()
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_NOTIFY


Creat0R 09-09-2010 23:27 1492134

Öèòàòà:

Öèòàòà saavaage
íå óâåðåí, ÷òî ïðàâèëüíî ïîíÿë ìûñëü Creat0R »

Âñ¸ ïðàâèëüíî :)


Âðåìÿ: 17:04.

Âðåìÿ: 17:04.
© OSzone.net 2001-