MessageFunc() is obsolete
[color=#AA1122]; Alert : Experimental Code !!![/color] #SingleInstance, Force Gui +LastFound hwnd := WinExist(), Params := "somestuff" MessageFunc( "MySpecialFunction", hwnd, &Params, 50 ) MsgBox Regular Thread Return MessageFunc( Func, hWnd, wParam=0, Delay=0 ) { ; SetTimer for Function - By SKAN Static S ; www.autohotkey.com/forum/viewtopic.php?t=63863 If VarSetCapacity( S ) ; CD:19-Oct-2010 DllCall( "ExitThread", UInt, DllCall( "Sleep", UInt,NumGet( S ) ) + DllCall( "PostMessage", UInt,NumGet(S,4), UInt,NumGet(S,8), UInt,NumGet(S,12), UInt,0 ) + DllCall( "GlobalFree", UInt,NumGet(S,16) ) ; Release Registered Callback + VarSetCapacity(S,0) ; Free Static variable + ( OnMessage( NumGet( S,8 ),"" ) < 1 ) ) ; Set Message Monitor OFF If ! IsFunc( Func ) Return 0 Msg := DllCall( "RegisterWindowMessage", Str,Func ), OnMessage( Msg, Func ) CBA := RegisterCallback( A_ThisFunc, "Fast", 4, &S ) VarSetCapacity( S,64 ), NumPut( Delay , S, 0 ), NumPut( hwnd , S, 4 ) NumPut( Msg , S, 8 ), NumPut( wParam, S,12 ), NumPut( CBA , S,16 ) Return 1, DllCall( "CreateThread", UInt,0, UInt,0, UInt,CBA, UInt,0, UInt,0, UInt,0 ) } MySpecialFunction( wParam ) { MsgBox,0, %A_ThisFunc%(), Pointer to Parameters: %wParam% }