Компьютерный форум 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 »

Всё правильно :)


Время: 00:44.

Время: 00:44.
© OSzone.net 2001-