Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  | Правила  

Компьютерный форум OSzone.net » Программирование, базы данных и автоматизация действий » AutoIt » [решено] Не отрабатывает кнопка "Обновить" у скрипта

Ответить
Настройки темы
[решено] Не отрабатывает кнопка "Обновить" у скрипта

Ветеран


Сообщения: 903
Благодарности: 161


Конфигурация

Профиль | Отправить PM | Цитировать


Изменения
Автор: saavaage
Дата: 09-09-2010
Вложения
Тип файла: 7z DeviceAPI.7z
(5.3 Kb, 10 просмотров)
Собственно, проблемы:
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 (см. архив)

-------
мы рождены, чтоб сказку сделать былью


Отправлено: 12:11, 09-09-2010

 

Аватара для Creat0R

Must AutoIt


Сообщения: 3054
Благодарности: 1009

Профиль | Сайт | Отправить PM | Цитировать


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

-------
“Сделай так просто, как возможно, но не проще этого.”... “Ты никогда не решишь проблему, если будешь думать так же, как те, кто её создал.”

Альберт Эйнштейн

P.S «Не оказываю техподдержку через ПМ/ICQ, и по email - для этого есть форум. ©»

http://creator-lab.ucoz.ru/Images/Icons/autoit_icon.png Русское сообщество AutoIt | http://creator-lab.ucoz.ru/Images/Ic...eator_icon.png CreatoR's Lab | http://creator-lab.ucoz.ru/Images/Icons/oac_icon.png Opera AC Community

Это сообщение посчитали полезным следующие участники:

Отправлено: 19:53, 09-09-2010 | #2



Для отключения данного рекламного блока вам необходимо зарегистрироваться или войти с учетной записью социальной сети.

Если же вы забыли свой пароль на форуме, то воспользуйтесь данной ссылкой для восстановления пароля.


Ветеран


Сообщения: 903
Благодарности: 161

Профиль | Отправить PM | Цитировать


Тема решена. На всякий случай, выкладываю код, предоставленный 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

-------
мы рождены, чтоб сказку сделать былью


Отправлено: 23:14, 09-09-2010 | #3


Аватара для Creat0R

Must AutoIt


Сообщения: 3054
Благодарности: 1009

Профиль | Сайт | Отправить PM | Цитировать


Цитата saavaage:
не уверен, что правильно понял мысль Creat0R »
Всё правильно

-------
“Сделай так просто, как возможно, но не проще этого.”... “Ты никогда не решишь проблему, если будешь думать так же, как те, кто её создал.”

Альберт Эйнштейн

P.S «Не оказываю техподдержку через ПМ/ICQ, и по email - для этого есть форум. ©»

http://creator-lab.ucoz.ru/Images/Icons/autoit_icon.png Русское сообщество AutoIt | http://creator-lab.ucoz.ru/Images/Ic...eator_icon.png CreatoR's Lab | http://creator-lab.ucoz.ru/Images/Icons/oac_icon.png Opera AC Community


Отправлено: 23:27, 09-09-2010 | #4



Компьютерный форум OSzone.net » Программирование, базы данных и автоматизация действий » AutoIt » [решено] Не отрабатывает кнопка "Обновить" у скрипта

Участник сейчас на форуме Участник сейчас на форуме Участник вне форума Участник вне форума Автор темы Автор темы Шапка темы Сообщение прикреплено

Похожие темы
Название темы Автор Информация о форуме Ответов Последнее сообщение
Доступ - [решено] Недоступна кнопка "Общий доступ..." в свойствах папки kefi Microsoft Windows 7 21 24-04-2010 00:51
Интерфейс - Почему в "Параметрах папки" кнопка "Применить ко всем папкам" неактивна? edixxx Microsoft Windows 7 2 19-05-2009 17:50
Доступ - Не работает кнопка "Обзор" или "Browse" volneb Microsoft Windows 7 0 21-02-2009 16:56
Outlook 2000 + Exchange 2003, ошибка "не удается обновить данные о занятости" mleck Microsoft Exchange Server 0 08-02-2007 13:31
Запретить/удалить пункт "Programs" ("Программы") из меню кнопки "Start" ("Пуск") submaster Microsoft Windows NT/2000/2003 5 13-09-2006 12:29




 
Переход