DllCallbackDestroy

Releases all resources associated with callback handle created by the DllCallbackCreate function.

Syntax:

DllCallbackDestroy ( handle )

Parameters:

(i) handle: handle created using DllCallbackCreate.

Returns:

(i) @TRUE.

 

After destroying the handle, it cannot be used as a parameter to the DllCall or DllCallCdecl functions.  

This function cannot be called from a UDF or UDS while it is executing as an application-defined callback for an external function.

Example:
; DllCall with Callback example.
#DefineFunction udfEnumWindowsProc(hwnd, lparam)
      ; This callback will run until:
      ;   Callback returns FALSE
      ;   There are no more top level windows to enumerate
      maxsize = 256
      lptitle = BinaryAlloc(maxsize)
      BinaryEodSet(lptitle, 0)
      length = DllCall(DirWindows(1):'user32.dll', long:'GetWindowTextA',long:hwnd,lpbinary:lptitle,long:maxsize)
      If length>1
         BinaryEodSet(lptitle, length)
         title = BinaryPeekStr(lptitle, 0, length)
         If StrIndex( title, lparam, 1, @FWDSCAN )
            ret = AskYesNo( lparam:' window exists!', 'Close this window? [':title:']' )
            If ret == @YES Then WinClose(title) ;Close Window
         EndIf
      EndIf
      BinaryFree(lptitle)
      Return @TRUE
#EndFunction
; Locates window and closes it
lookfortitle = 'Notepad'
ShellExecute('Notepad.exe', '', '', @NORMAL, '')
TimeDelay(1)
cbhandle = DllCallbackCreate('udfEnumWindowsProc', 'LONG', 'LONG LPSTR')
ret = DllCall( DirWindows(1):'user32.dll', long:'EnumWindows',callback:cbhandle,lpstr:lookfortitle)
DllCallbackDestroy(cbhandle)
Exit
See Also:

DataCast, DllCall, DllCallbackCreate, DllCallCdecl, DllCall Additional information, Binary Operations, DllLoad, DllFree, DllHwnd, DllHinst