Custom Query (3931 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (43 - 45 of 3931)

Ticket Resolution Summary Owner Reporter
#3736 Duplicate _GUICtrlTreeView_Sort fails when there is just one item in TreeView Andy289
Description

I know that there is nothing to sort if you have just one item but a proper validation should be performed to avoid an array subscript dimension range exceeded error.

Func _GUICtrlTreeView_Sort($hWnd)
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)

    Local $iItemCount = _GUICtrlTreeView_GetCount($hWnd)    ; <------------- if $iItemCount = 1
    If $iItemCount Then
        Local $aTreeView[$iItemCount], $i = 0               ; <------------- this array has just an index
        ; get only A child at each level
        Local $hHandle = _GUICtrlTreeView_GetFirstItem($hWnd)
        $aTreeView[1] = $hHandle                            ; <------------- and this would fail
        $aTreeView[0] = 2
        __GUICtrlTreeView_SortGetFirstChild($hWnd, $hHandle, $aTreeView)
        ReDim $aTreeView[$aTreeView[0]]
        $aTreeView[0] = 0

        For $i = 0 To UBound($aTreeView) - 1
            _SendMessage($hWnd, $TVM_SORTCHILDREN, 0, $aTreeView[$i], 0, "wparam", "handle") ; Sort the items in root
        Next
    EndIf

EndFunc   ;==>_GUICtrlTreeView_Sort
#1794 No Bug Opt("GuiCloseOnESC", 0) causes WinClose() to be ignored AndyS01@…
Description

When a script is compiled with Opt("GuiCloseOnESC", 0) active, another script, after getting its handle cannot close the first script. The WinClose() returns an OK status, but it really doesn't work. Compiling the first script with Opt("GuiCloseOnESC", 1) avtive works OK.

To reproduce: compile the test script, below; open a DOS window; run the compiled script; run the compiled script again. This time, there will be an error MsgBox complaining that the instance was not killed.

Change Opt("GuiCloseOnESC", 0) to Opt("GuiCloseOnESC", 1) and run the reproduce steps again. This time it works OK.

Test script:

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

[b]Opt("GuiCloseOnESC", 0)[/b]
Global $sCurrentTitle = "Test WinClose()"

runUnique() ; Kill off any currently running version of this script

$hGUI = GUICreate($sCurrentTitle, 300, 200)

$hListView = _GUICtrlListView_Create($hGUI, "Items|SubItems", 2, 2, 296, 196, $LVS_REPORT)

For $i = 1 To 10
    _GUICtrlListView_AddItem($hListView, @HOUR & ":" & @MIN & ":" & @SEC & " - " & $i)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 1)
Next

GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
exit (1)

Func runUnique()
    Local $hWnd, $res, $title = $sCurrentTitle

    if (WinActivate($title, "") <> 0) Then
        $hWnd = WinGetHandle($title, "")
        If (Not IsHWnd($hWnd)) Then $hWnd = HWnd($hWnd)
        if (IsHWnd($hWnd)) Then
            $res = WinClose($hWnd)
            if ($res == 0) Then
                ConsoleWrite("+++: WinClose() failed")
                $res = WinKill($hWnd)
                ConsoleWrite("+++: WinKill() returned " & $res & @CRLF)
                if ($res == 0) Then
                    ConsoleWrite("+++: WinKill() failed")
                EndIf
            EndIf

            if (WinActivate($title, "") <> 0) Then
                MsgBox(0, "ERROR", "Cannot kill window")
            Else
                MsgBox(0, "INFO", "Killed other window")
            EndIf
        Else
            MsgBox(0, "ERROR", "Cannot get win handle")
        EndIf
    EndIf
EndFunc   ;==>runUnique
#3780 Completed WinSetTitle reverts to default upon window focus on Notepad.exe >= Windows 19H1 Jpm AndyS19a@…
Description

I have a function that opens Notepad and sets its window title. However, the title reverts to whatever its default was when the Notepad window gets focus. To reproduce, run the WinSetTitle.au3 in the Examples folder, then move the cursor before the timeout expires.

Example()

Func Example()
	; Run Notepad
	Run("notepad.exe")

	; Wait 10 seconds for the Notepad window to appear.
	Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)

	; Set the title of the Notepad window using the handle returned by WinWait.
	WinSetTitle($hWnd, "", "New Notepad Title - AutoIt")

	; Wait for 2 seconds to display the Notepad window and the new title.
	Sleep(2000)

	; Close the Notepad window using the handle returned by WinWait.
	WinClose($hWnd)
EndFunc   ;==>Example
Batch Modify
Note: See TracBatchModify for help on using batch modify.
Note: See TracQuery for help on using queries.