Code: Select all
Procedure.i CallFast(hFunc,Array Args.l(1))
Protected size.l=ArraySize(Args()),res.i
If hFunc
!mov ecx,dword[p.v_size]
!mov eax,dword[p.v_hFunc]
!or ecx,ecx
!jz .CallFast_NoArgs
!mov edi,dword[p.a_Args]
!mov edi,dword[edi]
!@@:push dword[edi+ecx*4]
!dec ecx
!jnl @r
!.CallFast_NoArgs:
!call eax
!mov dword[p.v_res],eax
EndIf
ProcedureReturn res
EndProcedure
Dim a.l(0)
If OpenLibrary(0,"User32.dll")
f = GetFunction(0,"GetForegroundWindow")
CallFast(f,a())
EndIf