Function Reference

DllCallbackFree

Frees a previously created handle created with DllCallbackRegister.

DllCallbackFree ( handle )

 

Parameters

handle The DllCallback handle, as returned by a previous call to DllCallbackRegister.

 

Return Value

None.

 

Remarks

Upon termination, AutoIt automatically closes any handles it opened but calling DllCallbackFree is still a good idea.

 

Related

DllCall, DllCallbackGetPtr, DllCallbackRegister

 

Example



; Create callback function
$handle = DLLCallbackRegister ("_EnumWindowsProc", "int", "hwnd;lparam")     

; Call EnumWindows
DllCall("user32.dll", "int", "EnumWindows", "ptr", DllCallbackGetPtr($handle), "lparam", 10)

; Delete callback function
DllCallbackFree($handle)

; Callback Procedure
Func _EnumWindowsProc($hWnd, $lParam)
    If WinGetTitle($hWnd) <> "" And BitAnd(WinGetState($hWnd), 2) Then
        $res = MsgBox(1, WinGetTitle($hWnd), "$hWnd=" & $hWnd & @CRLF & "lParam=" & $lParam & @CRLF & "$hWnd(type)=" & VarGetType($hWnd))
        If $res = 2 Then Return 0   ; Cancel clicked, return 0 to stop enumeration
    EndIf
    Return 1    ; Return 1 to continue enumeration
EndFunc