Jump to content

Recommended Posts

Posted

Sorry,I English is very poor

This page was automatically translated from Chinese.

How to select volume control in the checkbox

This is some info.

>>>> Window <<<<

Title: attribute categories: # 32770

Coordinates: 395, 182

Size: 342, 407

Style: 0x94C820C4

Expansion of style: 0x00010501

Handle: 0x001C0544

>>>> Control <<<<

Categories: SysListView32

Enumeration: 1

Category: SysListView321

ID: 1017

Text:

Coordinates: 11, 183

Size: 317, 144

Control coordinates: 113, 58

Style: 0x50114001

Expansion of style: 0x00000204

Handle: 0x002C04D8

>>>> Mouse <<<<

Coordinates: 522, 452

Cursor ID: 2

Color: 0xFFFFFF

>>>> Status bar <<<<

>>>> Visible text <<<<

Mixer (& M):

Realtek AC97 Audio

Adjust the volume players (& P)

Recordings (& R)

Other (& O)

Show the following volume control:

OK Cancel

>>>> Hidden text <<<<

==========

I would like to be free to choose the things required, regardless of whether the current choice of the.

1 how to judge whether the current state has been select,

2 How to choose, in addition to space, or use the mouse relative quantities, is there any good way.

ControlListView ( "Properties", "", "SysListView321", "SelectAll")

Like this in the statement, although both have been selected, but did not checked

thank you!

post-31455-1200980320_thumb.jpg

Posted (edited)

You need to get/set listview item checkbox?

Use _GUICtrlListView_GetItemChecked and _GUICtrlListView_SetItemChecked from GuiListView UDF.

Although I just noticed that currently _GUICtrlListView_GetItemChecked func does not support external listviews, so here's a working modified version of that function, until it gets officially fixed.

Func _GUICtrlListView_GetItemCheckedEx($hWnd, $iIndex)
    If $Debug_LV Then _GUICtrlListView_ValidateClassName($hWnd)
    Local $struct_LVITEM = DllStructCreate($tagLVITEM), $iResult, $tMemMap
    If @error Then Return SetError($LV_ERR, $LV_ERR, False)
    DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
    DllStructSetData($struct_LVITEM, "Item", $iIndex)
    DllStructSetData($struct_LVITEM, "StateMask", 0xffff)

    If IsHWnd($hWnd) Then
        If _WinAPI_InProcess($hWnd, $_lv_ghLastWnd) Then
            $iResult = _SendMessage($hWnd, $LVM_GETITEMA, 0, DllStructGetPtr($struct_LVITEM), 0, "wparam", "ptr") <> 0
        Else
            $pMemory = _MemInit($hWnd, DllStructGetSize($struct_LVITEM), $tMemMap)
            _MemWrite($tMemMap, DllStructGetPtr($struct_LVITEM))
            $iResult = _SendMessage($hWnd, $LVM_GETITEMA, 0, $pMemory, 0, "wparam", "ptr") <> 0
            _MemRead($tMemMap, $pMemory, DllStructGetPtr($struct_LVITEM), DllStructGetSize($struct_LVITEM))
            _MemFree($tMemMap)
        EndIf
    Else
        $iResult = GUICtrlSendMsg($hWnd, $LVM_GETITEMA, 0, DllStructGetPtr($struct_LVITEM)) <> 0
    EndIf
    
    If Not $iResult Then Return SetError($LV_ERR, $LV_ERR, False)
    Return BitAND(DllStructGetData($struct_LVITEM, "State"), 0x2000) <> 0
EndFunc ;==>_GUICtrlListView_GetItemChecked

Example:

#Include <GuiListView.au3>

$sWinTitle = "Properties"
$hListView = ControlGetHandle($sWinTitle, "Mixer", "SysListView321")

$s = ""
For $i = 0 To ControlListView($sWinTitle, "Mixer", "SysListView321", "GetItemCount")-1
    $s &= StringFormat('Index = %d\tName = %s\tChecked = %s\r\n', $i, _
                            ControlListView($sWinTitle, "Mixer", "SysListView321", "GetText", $i, 0), _
                            _GUICtrlListView_GetItemCheckedEx($hListView, $i) _
                        )
    ;If Not _GUICtrlListView_GetItemCheckedEx($hListView, $i) Then _GUICtrlListView_SetItemChecked($hListView, $i)
Next
MsgBox(0,'',$s)
Edited by Siao

"be smart, drink your wine"

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
  • Recently Browsing   0 members

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