ScriptingLanguage Programmers - Calling API

Share your advanced PureBasic knowledge/code with the community.
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

ScriptingLanguage Programmers - Calling API

Post by Inf0Byt3 »

Code updated For 5.20+

Well, I know this is not much, but it could do the trick ;)
This code is incomplete, if anyone can continue it please post it here. BTW, S stands for string and L for Long.

[UPDATE]
Now you can call functions with up to 6 parameters.

Code: Select all

Procedure Call_1L(*func,param)
  ProcedureReturn CallFunctionFast(*func,param)
EndProcedure
Procedure Call_1S(*func,param.s)
  ProcedureReturn CallFunctionFast(*func,@param.s)
EndProcedure
Procedure Call_2LL(*func,param1,param2)
  ProcedureReturn CallFunctionFast(*func,param1,param2)
EndProcedure
Procedure Call_2SS(*func,param1.s,param2.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s)
EndProcedure
Procedure Call_2LS(*func,param1,param2.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s)
EndProcedure
Procedure Call_2SL(*func,param1.s,param2)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2)
EndProcedure
Procedure Call_3LLL(*func,param1,param2,param3)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3)
EndProcedure
Procedure Call_3SSS(*func,param1.s,param2.s,param3.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s)
EndProcedure
Procedure Call_3LLS(*func,param1,param2,param3.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s)
EndProcedure
Procedure Call_3LSL(*func,param1,param2.s,param3)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3)
EndProcedure
Procedure Call_3SLL(*func,param1.s,param2,param3)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3)
EndProcedure
Procedure Call_3SLS(*func,param1.s,param2,param3.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s)
EndProcedure
Procedure Call_3LSS(*func,param1,param2.s,param3.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s)
EndProcedure
Procedure Call_3SSL(*func,param1.s,param2.s,param3)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3)
EndProcedure
Procedure Call_4LLLL(*func,param1,param2,param3,param4)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,param4)
EndProcedure
Procedure Call_4LLLS(*func,param1,param2,param3,param4.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,@param4.s)
EndProcedure
Procedure Call_4LLSL(*func,param1,param2,param3.s,param4)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,param4)
EndProcedure
Procedure Call_4LLSS(*func,param1,param2,param3.s,param4.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,@param4.s)
EndProcedure
Procedure Call_4LSLL(*func,param1,param2.s,param3,param4)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,param4)
EndProcedure
Procedure Call_4LSLS(*func,param1,param2.s,param3,param4.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,@param4.s)
EndProcedure
Procedure Call_4LSSL(*func,param1,param2.s,param3.s,param4)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,param4)
EndProcedure
Procedure Call_4LSSS(*func,param1,param2.s,param3.s,param4.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,@param4.s)
EndProcedure
Procedure Call_4SLLL(*func,param1.s,param2,param3,param4)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,param4)
EndProcedure
Procedure Call_4SLLS(*func,param1.s,param2,param3,param4.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,@param4.s)
EndProcedure
Procedure Call_4SLSL(*func,param1.s,param2,param3.s,param4)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,param4)
EndProcedure
Procedure Call_4SLSS(*func,param1.s,param2,param3.s,param4.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,@param4.s)
EndProcedure
Procedure Call_4SSLL(*func,param1.s,param2.s,param3,param4)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,param4)
EndProcedure
Procedure Call_4SSLS(*func,param1.s,param2.s,param3,param4.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,@param4.s)
EndProcedure
Procedure Call_4SSSL(*func,param1.s,param2.s,param3.s,param4)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,param4)
EndProcedure
Procedure Call_4SSSS(*func,param1.s,param2.s,param3.s,param4.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,@param4.s)
EndProcedure
Procedure Call_5LLLLL(*func,param1,param2,param3,param4,param5)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,param4,param5)
EndProcedure
Procedure Call_5LLLLS(*func,param1,param2,param3,param4,param5.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,param4,@param5.s)
EndProcedure
Procedure Call_5LLLSL(*func,param1,param2,param3,param4.s,param5)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,@param4.s,param5)
EndProcedure
Procedure Call_5LLLSS(*func,param1,param2,param3,param4.s,param5.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,@param4.s,@param5.s)
EndProcedure
Procedure Call_5LLSLL(*func,param1,param2,param3.s,param4,param5)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,param4,param5)
EndProcedure
Procedure Call_5LLSLS(*func,param1,param2,param3.s,param4,param5.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,param4,@param5.s)
EndProcedure
Procedure Call_5LLSSL(*func,param1,param2,param3.s,param4.s,param5)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,@param4.s,param5)
EndProcedure
Procedure Call_5LLSSS(*func,param1,param2,param3.s,param4.s,param5.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,@param4.s,@param5.s)
EndProcedure
Procedure Call_5LSLLL(*func,param1,param2.s,param3,param4,param5)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,param4,param5)
EndProcedure
Procedure Call_5LSLLS(*func,param1,param2.s,param3,param4,param5.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,param4,@param5.s)
EndProcedure
Procedure Call_5LSLSL(*func,param1,param2.s,param3,param4.s,param5)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,@param4.s,param5)
EndProcedure
Procedure Call_5LSLSS(*func,param1,param2.s,param3,param4.s,param5.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,@param4.s,@param5.s)
EndProcedure
Procedure Call_5LSSLL(*func,param1,param2.s,param3.s,param4,param5)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,param4,param5)
EndProcedure
Procedure Call_5LSSLS(*func,param1,param2.s,param3.s,param4,param5)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,param4,param5)
EndProcedure
Procedure Call_5LSSSL(*func,param1,param2.s,param3.s,param4.s,param5)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,@param4.s,param5)
EndProcedure
Procedure Call_5LSSSS(*func,param1,param2.s,param3.s,param4.s,param5.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,@param4.s,@param5.s)
EndProcedure
Procedure Call_5SLLLL(*func,param1.s,param2,param3,param4,param5)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,param4,param5)
EndProcedure
Procedure Call_5SLLLS(*func,param1.s,param2,param3,param4,param5.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,param4,@param5.s)
EndProcedure
Procedure Call_5SLLSL(*func,param1.s,param2,param3,param4.s,param5)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,@param4.s,param5)
EndProcedure
Procedure Call_5SLLSS(*func,param1.s,param2,param3,param4.s,param5.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,@param4.s,@param5.s)
EndProcedure
Procedure Call_5SLSLL(*func,param1.s,param2,param3.s,param4,param5)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,param4,param5)
EndProcedure
Procedure Call_5SLSLS(*func,param1.s,param2,param3.s,param4,param5.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,param4,@param5.s)
EndProcedure
Procedure Call_5SLSSL(*func,param1.s,param2,param3.s,param4.s,param5)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,@param4.s,param5)
EndProcedure
Procedure Call_5SLSSS(*func,param1.s,param2,param3.s,param4.s,param5.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,@param4.s,@param5.s)
EndProcedure
Procedure Call_5SSLLL(*func,param1.s,param2.s,param3,param4,param5)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,param4,param5)
EndProcedure
Procedure Call_5SSLLS(*func,param1.s,param2.s,param3,param4,param5.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,param4,@param5.s)
EndProcedure
Procedure Call_5SSLSL(*func,param1.s,param2.s,param3,param4.s,param5)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,@param4.s,param5)
EndProcedure
Procedure Call_5SSLSS(*func,param1.s,param2.s,param3,param4.s,param5.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,@param4.s,@param5.s)
EndProcedure
Procedure Call_5SSSLL(*func,param1.s,param2.s,param3.s,param4,param5)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,param4,param5)
EndProcedure
Procedure Call_5SSSLS(*func,param1.s,param2.s,param3.s,param4,param5.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,param4,@param5.s)
EndProcedure
Procedure Call_5SSSSL(*func,param1.s,param2.s,param3.s,param4.s,param5)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,@param4.s,param5)
EndProcedure
Procedure Call_5SSSSS(*func,param1.s,param2.s,param3.s,param4.s,param5.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,@param4.s,@param5.s)
EndProcedure
Procedure Call_6LLLLLL(*func,param1,param2,param3,param4,param5,param6)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,param4,param5,param6)
EndProcedure
Procedure Call_6LLLLLS(*func,param1,param2,param3,param4,param5,param6)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,param4,param5,param6)
EndProcedure
Procedure Call_6LLLLSL(*func,param1,param2,param3,param4,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,param4,@param5.s,param6)
EndProcedure
Procedure Call_6LLLLSS(*func,param1,param2,param3,param4,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,param4,@param5.s,param6)
EndProcedure
Procedure Call_6LLLSLL(*func,param1,param2,param3,param4.s,param5,param6)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,@param4.s,param5,param6)
EndProcedure
Procedure Call_6LLLSLS(*func,param1,param2,param3,param4.s,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,@param4.s,param5,@param6.s)
EndProcedure
Procedure Call_6LLLSSL(*func,param1,param2,param3,param4.s,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,@param4.s,@param5.s,param6)
EndProcedure
Procedure Call_6LLLSSS(*func,param1,param2,param3,param4.s,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,param3,@param4.s,@param5.s,@param6.s)
EndProcedure
Procedure Call_6LLSLLL(*func,param1,param2,param3.s,param4,param5,param6)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,param4,param5,param6)
EndProcedure
Procedure Call_6LLSLLS(*func,param1,param2,param3.s,param4,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,param4,param5,@param6.s)
EndProcedure
Procedure Call_6LLSLSL(*func,param1,param2,param3.s,param4,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,param4,@param5.s,param6)
EndProcedure
Procedure Call_6LLSLSS(*func,param1,param2,param3.s,param4,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,param4,@param5.s,@param6.s)
EndProcedure
Procedure Call_6LLSSLL(*func,param1,param2,param3.s,param4.s,param5,param6)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,@param4.s,param5,param6)
EndProcedure
Procedure Call_6LLSSLS(*func,param1,param2,param3.s,param4.s,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,@param4.s,param5,@param6.s)
EndProcedure
Procedure Call_6LLSSSL(*func,param1,param2,param3.s,param4.s,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,@param4.s,@param5.s,param6)
EndProcedure
Procedure Call_6LLSSSS(*func,param1,param2,param3.s,param4.s,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,param2,@param3.s,@param4.s,@param5.s,@param6.s)
EndProcedure
Procedure Call_6LSLLLL(*func,param1,param2.s,param3,param4,param5,param6)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,param4,param5,param6)
EndProcedure
Procedure Call_6LSLLLS(*func,param1,param2.s,param3,param4,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,param4,param5,@param6.s)
EndProcedure
Procedure Call_6LSLLSL(*func,param1,param2.s,param3,param4,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,param4,@param5.s,param6)
EndProcedure
Procedure Call_6LSLLSS(*func,param1,param2.s,param3,param4,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,param4,@param5.s,@param6.s)
EndProcedure
Procedure Call_6LSLSLL(*func,param1,param2.s,param3,param4.s,param5,param6)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,@param4.s,param5,param6)
EndProcedure
Procedure Call_6LSLSLS(*func,param1,param2.s,param3,param4.s,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,@param4.s,param5,@param6.s)
EndProcedure
Procedure Call_6LSLSSL(*func,param1,param2.s,param3,param4.s,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,@param4.s,@param5.s,param6)
EndProcedure
Procedure Call_6LSLSSS(*func,param1,param2.s,param3,param4.s,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,param3,@param4.s,@param5.s,@param6.s)
EndProcedure
Procedure Call_6LSSLLL(*func,param1,param2.s,param3.s,param4,param5,param6)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,param4,param5,param6)
EndProcedure
Procedure Call_6LSSLLS(*func,param1,param2.s,param3.s,param4,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,param4,param5,@param6.s)
EndProcedure
Procedure Call_6LSSLSL(*func,param1,param2.s,param3.s,param4,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,param4,@param5.s,param6)
EndProcedure
Procedure Call_6LSSLSS(*func,param1,param2.s,param3.s,param4,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,param4,@param5.s,@param6.s)
EndProcedure
Procedure Call_6LSSSLL(*func,param1,param2.s,param3.s,param4.s,param5,param6)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,@param4.s,param5,param6)
EndProcedure
Procedure Call_6LSSSLS(*func,param1,param2.s,param3.s,param4.s,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,@param4.s,param5,@param6.s)
EndProcedure
Procedure Call_6LSSSSL(*func,param1,param2.s,param3.s,param4.s,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,@param4.s,@param5.s,param6)
EndProcedure
Procedure Call_6LSSSSS(*func,param1,param2.s,param3.s,param4.s,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,param1,@param2.s,@param3.s,@param4.s,@param5.s,@param6.s)
EndProcedure
Procedure Call_6SLLLLL(*func,param1.s,param2,param3,param4,param5,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,param4,param5,param6)
EndProcedure
Procedure Call_6SLLLLS(*func,param1.s,param2,param3,param4,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,param4,param5,@param6.s)
EndProcedure
Procedure Call_6SLLLSL(*func,param1.s,param2,param3,param4,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,param4,@param5.s,param6)
EndProcedure
Procedure Call_6SLLLSS(*func,param1.s,param2,param3,param4,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,param4,@param5.s,@param6.s)
EndProcedure
Procedure Call_6SLLSLL(*func,param1.s,param2,param3,param4.s,param5,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,@param4.s,param5,param6)
EndProcedure
Procedure Call_6SLLSLS(*func,param1.s,param2,param3,param4.s,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,@param4.s,param5,@param6.s)
EndProcedure
Procedure Call_6SLLSSL(*func,param1.s,param2,param3,param4.s,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,@param4.s,@param5.s,param6)
EndProcedure
Procedure Call_6SLLSSS(*func,param1.s,param2,param3,param4.s,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,@param4.s,@param5.s,@param6.s)
EndProcedure
Procedure Call_6SLSLLL(*func,param1.s,param2,param3.s,param4,param5,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,param4,param5,param6)
EndProcedure
Procedure Call_6SLSLLS(*func,param1.s,param2,param3,param4.s,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,param3,@param4.s,param5,@param6.s)
EndProcedure
Procedure Call_6SLSLSL(*func,param1.s,param2,param3.s,param4,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,param4,@param5.s,param6)
EndProcedure
Procedure Call_6SLSLSS(*func,param1.s,param2,param3.s,param4,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,param4,@param5.s,@param6.s)
EndProcedure
Procedure Call_6SLSSLL(*func,param1.s,param2,param3.s,param4.s,param5,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,@param4.s,param5,param6)
EndProcedure
Procedure Call_6SLSSLS(*func,param1.s,param2,param3.s,param4.s,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,@param4.s,param5,@param6.s)
EndProcedure
Procedure Call_6SLSSSL(*func,param1.s,param2,param3.s,param4.s,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,@param4.s,@param5.s,param6)
EndProcedure
Procedure Call_6SLSSSS(*func,param1.s,param2,param3.s,param4.s,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,param2,@param3.s,@param4.s,@param5.s,@param6.s)
EndProcedure
Procedure Call_6SSLLLL(*func,param1.s,param2.s,param3,param4,param5,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,param4,param5,param6)
EndProcedure
Procedure Call_6SSLLLS(*func,param1.s,param2.s,param3,param4,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,param4,param5,@param6.s)
EndProcedure
Procedure Call_6SSLLSL(*func,param1.s,param2.s,param3,param4,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,param4,@param5.s,param6)
EndProcedure
Procedure Call_6SSLLSS(*func,param1.s,param2.s,param3,param4,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,param4,@param5.s,@param6.s)
EndProcedure
Procedure Call_6SSLSLL(*func,param1.s,param2.s,param3,param4.s,param5,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,@param4.s,param5,param6)
EndProcedure
Procedure Call_6SSLSLS(*func,param1.s,param2.s,param3,param4.s,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,@param4.s,param5,@param6.s)
EndProcedure
Procedure Call_6SSLSSL(*func,param1.s,param2.s,param3,param4.s,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,@param4.s,@param5.s,param6)
EndProcedure
Procedure Call_6SSLSSS(*func,param1.s,param2.s,param3,param4.s,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,param3,@param4.s,@param5.s,@param6.s)
EndProcedure
Procedure Call_6SSSLLL(*func,param1.s,param2.s,param3.s,param4,param5,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,param4,param5,param6)
EndProcedure
Procedure Call_6SSSLLS(*func,param1.s,param2.s,param3.s,param4,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,param4,param5,@param6.s)
EndProcedure
Procedure Call_6SSSLSL(*func,param1.s,param2.s,param3.s,param4,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,param4,@param5.s,param6)
EndProcedure
Procedure Call_6SSSLSS(*func,param1.s,param2.s,param3.s,param4,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,param4,@param5.s,@param6.s)
EndProcedure
Procedure Call_6SSSSLL(*func,param1.s,param2.s,param3.s,param4.s,param5,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,@param4.s,param5,param6)
EndProcedure
Procedure Call_6SSSSLS(*func,param1.s,param2.s,param3.s,param4.s,param5,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,@param4.s,param5,@param6.s)
EndProcedure
Procedure Call_6SSSSSL(*func,param1.s,param2.s,param3.s,param4.s,param5.s,param6)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,@param4.s,@param5.s,param6)
EndProcedure
Procedure Call_6SSSSSS(*func,param1.s,param2.s,param3.s,param4.s,param5.s,param6.s)
  ProcedureReturn CallFunctionFast(*func,@param1.s,@param2.s,@param3.s,@param4.s,@param5.s,@param6.s)
EndProcedure

;A short test
OpenLibrary(0,"user32.dll")
*a = GetFunction(0,"MessageBoxA")
Call_4LSSL(*a,0,"asd","asdasd",48)

Basically, when in my script i have to call something, I read the parameters, I check their types and then call them with the proper command.
Last edited by Inf0Byt3 on Sat Mar 18, 2006 9:05 pm, edited 1 time in total.
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

It's interesting to me.

*thumbs up*
Intrigued - Registered PureBasic, lifetime updates user
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Thanks. Updated ^
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

That's some funny code! :lol:
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

when the code comes to 12 parameters ... o_O
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

I think 12 will be the maximum, though. I haven't seen much API calls with more than 12 params. My hand hurts (and my eyes too) from typing and stuff. I used an exponential function to generate permutations and i created all the possible combinations between "l" and "s" so from now on it's only Copy\Paste stuff...
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

@Inf0Byt3: please change your avatar.
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Why? What's wrong with it?
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
LuCiFeR[SD]
666
666
Posts: 1033
Joined: Mon Sep 01, 2003 2:33 pm

Post by LuCiFeR[SD] »

perhaps its the fact that people of all ages frequent the forum and Spanking is/can be considered a sexual/brutal act? even if it is just smilies :)
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

How's the new one? :D
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

what LuCiFeR[SD] said, Inf0Byt3, that's a cool avatar :)
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

:D
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
User avatar
Mischa
Enthusiast
Enthusiast
Posts: 115
Joined: Fri Aug 15, 2003 7:43 pm

Post by Mischa »

Hi!

With your method you have to write thousands of lines to complete
the list.

There is no need to make a difference between longs and strings.
You only have to use @String (Adress) instead of normal String.
Thats all.

Code: Select all

;Taken from D-LIB (script language)
;...

Procedure cxf0()
ProcedureReturn CallFunctionFast(Function(command)\id)
EndProcedure
Procedure cxf1()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1))
EndProcedure
Procedure cxf2()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2))
EndProcedure
Procedure cxf3()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3))
EndProcedure
Procedure cxf4()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3),p(4))
EndProcedure
Procedure cxf5()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3),p(4),p(5))
EndProcedure
Procedure cxf6()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3),p(4),p(5),p(6))
EndProcedure
Procedure cxf7()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3),p(4),p(5),p(6),p(7))
EndProcedure
Procedure cxf8()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3),p(4),p(5),p(6),p(7),p(8))
EndProcedure
Procedure cxf9()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3),p(4),p(5),p(6),p(7),p(8),p(9))
EndProcedure
Procedure cxf10()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3),p(4),p(5),p(6),p(7),p(8),p(9),p(10))
EndProcedure
Procedure cxf11()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3),p(4),p(5),p(6),p(7),p(8),p(9),p(10),p(11))
EndProcedure
Procedure cxf12()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3),p(4),p(5),p(6),p(7),p(8),p(9),p(10),p(11),p(12))
EndProcedure
Procedure cxf13()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3),p(4),p(5),p(6),p(7),p(8),p(9),p(10),p(11),p(12),p(13))
EndProcedure
Procedure cxf14()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3),p(4),p(5),p(6),p(7),p(8),p(9),p(10),p(11),p(12),p(13),p(14))
EndProcedure
Procedure cxf15()
ProcedureReturn CallFunctionFast(Function(command)\id,p(1),p(2),p(3),p(4),p(5),p(6),p(7),p(8),p(9),p(10),p(11),p(12),p(13),p(14),p(15))
EndProcedure

;...

FCB(0)=@cxf0()
FCB(1)=@cxf1()
FCB(2)=@cxf2()
FCB(3)=@cxf3()
FCB(4)=@cxf4()
FCB(5)=@cxf5()
FCB(6)=@cxf6()
FCB(7)=@cxf7()
FCB(8)=@cxf8()
FCB(9)=@cxf9()
FCB(10)=@cxf10()
FCB(11)=@cxf11()
FCB(12)=@cxf12()
FCB(13)=@cxf13()
FCB(14)=@cxf14()
FCB(15)=@cxf15()

;...

_templong=CallFunctionFast(FCB(Function(command)\params))

;...
Regards,
Mischa
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Thank you very much for sharing. Nice method 8).
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

You don't have to create one procedure for every parameter count.

Make sure I is 0. Put parameters in the Parameter() array, the number of parameters in NumberOfParameters, etc...

Code: Select all

Filename.s = "user32.dll" 
Name.s = "MessageBoxA" 

NumberOfParameters = 4 

Dim Parameter(20) 
Parameter(0) = 0 
Parameter(1) = @"Title" 
Parameter(2) = @"Message" 
Parameter(3) = 0 


Debug OpenLibrary(0, Filename) 
I = 0 
!mov eax, [v_NumberOfParameters] 
!mov edx, [a_Parameter] 
!l_start: 
!cmp [v_I], eax 
!jz l_fin 
!push dword [edx] 
!add dword edx, 4 
!inc [v_I] 
!jmp l_start 
!l_fin: 
result = CallFunction(0, Name)
Post Reply