Jump to content

Some problems with list view check boxes


 Share

Recommended Posts

So I'm accessing a control panel in windows (windows firewall) that has a big listview with a series of checkboxes. I'm using the following code to ensure the first option is checked.

winwaitactive("ICMP Settings")
ControlFocus("ICMP Settings","", 101)
$handle = ControlGetHandle ("ICMP Settings", "", 101)
$checked = _GUICtrlListViewgetCheckedState ($handle, 1)

However, $checked = 1 no matter if the box is checked or not. I have verified that $handle is giving me a valid handle. Am I doing something wrong, or is there some crazy windows voodoo going on.

If this doesn't work, is there any alternate way I can make sure the option is checked? (without knowing if it was previously checked or not).

Edited by Stalker0
Link to comment
Share on other sites

So I'm accessing a control panel in windows (windows firewall) that has a big listview with a series of checkboxes. I'm using the following code to ensure the first option is checked.

winwaitactive("ICMP Settings")
ControlFocus("ICMP Settings","", 101)
$handle = ControlGetHandle ("ICMP Settings", "", 101)
$checked = _GUICtrlListViewgetCheckedState ($handle, 1)

However, $checked = 1 no matter if the box is checked or not. I have verified that $handle is giving me a valid handle. Am I doing something wrong, or is there some crazy windows voodoo going on.

If this doesn't work, is there any alternate way I can make sure the option is checked? (without knowing if it was previously checked or not).

Hmm... This should have worked (requires Beta), but I get a hung script that I have to kill via TaskManager:

#include <GuiListView.au3>

Opt("WinTitleMatchMode", 4)
$hWin = WinGetHandle("[CLASS:#32770;TITLE:Windows Firewall]")
If IsHWnd($hWin) Then
    $hSLV321 = ControlGetHandle($hWin, "", "[CLASS:SysListView32;INSTANCE:1]")
    If IsHWnd($hSLV321) Then
        $iCnt = _GUICtrlListView_GetItemCount ($hSLV321)
        ConsoleWrite("Debug: $iCnt = " & $iCnt & @LF)
        For $n = 0 To $iCnt - 1
            $State = _GUICtrlListView_GetItemChecked ($hSLV321, $n)
            ConsoleWrite("Debug: Item " & $n & " = " & $State & @LF)
        Next
    Else
        ConsoleWrite("Debug: Did not find SysListView32." & @LF)
    EndIf
Else
    ConsoleWrite("Debug: Did not find window." & @LF)
EndIf

Try it with the Windows Firewall manager open already, see if you get better results.

<_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...