where it gets caught by a handler function.
Sound's pretty tricky but i did my best to make it easy to use:
#include "DllCallBack.au3" ; Create Stub $hStub_EnumWindows = _DllCallBack ("_EnumWindowsProc", _ ; Name of the function "hwnd;ptr") ; DllStruct like parameter definition ; Only 32 and 64bit datatypes supported ; Call EnumWindows DllCall("user32.dll", "int", "EnumWindows", "ptr", $hStub_EnumWindows, "long", 0) ; Callback Procedure Func _EnumWindowsProc($hWnd, $lParam) $hWnd = HWnd($hWnd) ConsoleWrite($hWnd & " -> " & WinGetTitle($hWnd) & @CRLF) Return 1 EndFunc ;==>_EnumWindowsProc ; Free Stub _DllCallBack_Free ($hStub_EnumWindows)
More examples in the archive:
- EnumChildWindows
- EnumWindowStations
- SetWindowsHookEx (Mouse hook)
- CopyFileEx - Progress indicator for copying files. (NT4+)
- Richedit - EM_STREAMOUT & EM_STREAMIN
- LibCurl - Runtime dll not included, get it here
- Subclassing - Subclassing an edit box
- SetTimer - Multiple timers without Adlib
- An example dll - How to do callbacks from your own dll's in c and freebasic
Return type cannot be set, its always a 32bit integer (signed or unsigned, AutoIt converts it).
There is no stack corruption check like in DllCall so if you make a mistake in the parameter definition your application just crashes.
Only 64 functions can be registered simultaneously (this number can be increased by editing the source).
The windows message 0x7FFF (WM_USER + 0x7BFF) should not be used to avoid conflicts (can be changed too).
Since its based on GuiRegisterMsg() this warning applies here too:
Warning: blocking of running user functions which executes window messages with commands such as "Msgbox()" can lead to unexpected behaviour, the return to the system should be as fast as possible !!!
au3_callback_v6.5.zip 13.12K
3371 downloadsThis udf should work on every os Autoit runs on.
Tested on Win98, WinXP, Vista and Wine 0.9.x.
(Thanks to Zedna & jfisher)
Edited by piccaso, 09 September 2007 - 10:50 PM.




This topic is locked
