# Function Reference

# DllCallbackGetPtr

Returns the pointer to a callback function that can be passed to the Win32 API.

DllCallbackGetPtr ( handle )

## Parameters

handle | A DllCallback handle returned from DllCallbackRegister().

## Return Value

Success: | the pointer to the callback function.
Failure: | 0.

## Remarks

Use DllCallbackGetPtr() to pass the address of a callback function to the Win32 API when using DllCall().

## Related

DllCall, DllCallbackFree, DllCallbackRegister

## Example

    #include <MsgBoxConstants.au3>

    ; Create callback function.
    Local $hHandle = DllCallbackRegister("_EnumWindowsProc", "int", "hwnd;lparam")

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

    ; Delete callback function.
    DllCallbackFree($hHandle)

    ; Callback Procedure
    Func _EnumWindowsProc($hWnd, $lParam)
        ; If the Title is empty or if the window is not visible then continue enumeration.
        If WinGetTitle($hWnd) = "" Or BitAND(WinGetState($hWnd), 2) = 0 Then Return 1

        Local $iRes = MsgBox(($MB_OKCANCEL + $MB_SYSTEMMODAL), _
                WinGetTitle($hWnd), "$hWnd=" & $hWnd & @CRLF & _
                "$lParam=" & $lParam & @CRLF & _
                "$hWnd(type)=" & VarGetType($hWnd))

        If $iRes <> $IDOK Then Return 0 ; Cancel/Close button clicked, return 0 to stop enumeration.

        Return 1 ; Return 1 to continue enumeration.
    EndFunc   ;==>_EnumWindowsProc