Custom Query


Show under each result:

Results (49 - 51 of 3827)

Ticket Resolution Summary Owner Reporter
#240 Works For Me Add as Snippet Gary Firestorm

In SciTe, when you have selected text or nothing selected and right-click and click 'Add as Snippet', SciTe gives an error:

Error _GUIImageList_AddIcon: -1

#249 Fixed _WinAPI_UpdateLayeredWindow() - missing error checking Gary Zedna

in WinApi.au3 include file in _WinAPI_UpdateLayeredWindow() is missing error checking.

UpdateLayeredWindow API doesn't exists on WIN9x Windows (only WIN 2000 and above) so if you call this UDF function on WIN9x it crashes with this error:

==> Subscript used with non-Array variable.: 
Return SetError($aResult[0] = 0, 0, $aResult[0] <> 0) 
Return SetError($aResult^ ERROR

After DllCall() should be added this:

If @error Then Return SetError(1, 0, 0)

Here is complete testing script with original commented UDF and corrected one:

_WinAPI_UpdateLayeredWindow(0, 0, 0, 0, 0, 0, 0, 0, 0)

;~ Func _WinAPI_UpdateLayeredWindow($hWnd, $hDCDest, $pPTDest, $pSize, $hDCSrce, $pPTSrce, $iRGB, $pBlend, $iFlags)
;~ 	Local $aResult

;~ 	$aResult = DllCall("User32.dll", "int", "UpdateLayeredWindow", "hwnd", $hWnd, "hwnd", $hDCDest, "ptr", $pPTDest, "ptr", $pSize, _
;~ 			"hwnd", $hDCSrce, "ptr", $pPTSrce, "int", $iRGB, "ptr", $pBlend, "int", $iFlags)
;~ 	Return SetError($aResult[0] = 0, 0, $aResult[0] <> 0)
;~ EndFunc   ;==>_WinAPI_UpdateLayeredWindow

Func _WinAPI_UpdateLayeredWindow($hWnd, $hDCDest, $pPTDest, $pSize, $hDCSrce, $pPTSrce, $iRGB, $pBlend, $iFlags)
	Local $aResult

	$aResult = DllCall("User32.dll", "int", "UpdateLayeredWindow", "hwnd", $hWnd, "hwnd", $hDCDest, "ptr", $pPTDest, "ptr", $pSize, _
			"hwnd", $hDCSrce, "ptr", $pPTSrce, "int", $iRGB, "ptr", $pBlend, "int", $iFlags)
	If @error Then Return SetError(1, 0, 0)
	Return SetError($aResult[0] = 0, 0, $aResult[0] <> 0)
EndFunc   ;==>_WinAPI_UpdateLayeredWindow

All tested on AutoIt 3.2.10 on WIN98SE

#258 Fixed bugfix: hard crash when using _ClipBoard_GetData, (from the Clipboard UDF) Gary autoit@…

This one's been around a while, and I think maybe I've fixed it. Or something. I'm sure this will help someone, since I've seen this problem go unanswered in the archived bug report forum!

I found this proposed change by looking at examples given for the Clipboard API in other programming languages, and the one *difference* that they all had in common was to lock and copy the memory when reading from the clipboard.

Func _ClipBoard_GetData_Carefully($iFormat = 1)
Local $hMemory, $tData

Local $hMemoryDest, $hLock

If Not _ClipBoard_IsFormatAvailable($iFormat) Then Return SetError(-1, 0, 0)
If Not _ClipBoard_Open(0) Then Return SetError(-2, 0, 0)
$hMemory = _ClipBoard_GetDataEx($iFormat)
If $hMemory = 0 Then Return SetError(-3, 0, 0)
Switch $iFormat

;THIS WAS BAD: $tData = DllStructCreate("char Text[8192]", $hMemory)

$tData = DllStructCreate("char Text[8192]") ; do it this way so it is allocated...?
$hMemoryDest = DllStructGetPtr($tData)

; so let's lock that clipboard memory down and make our own for-sure copy.
$hLock = _MemGlobalLock($hMemory)
If $hLock = 0 Then Return SetError(-4, 0, 0)
; OK, $hLock should now be the pointer into the clipboard memory
_MemMoveMemory($hLock, $hMemoryDest, 8192)
; OK *now* we should have our own, good copy.

Return DllStructGetData($tData, "Text")
Return _WinAPI_WideCharToMultiByte($tData)
Case Else
Return $hMemory
EndFunc ;==>_ClipBoard_GetData_Carefully
Note: See TracQuery for help on using queries.