Jump to content

Call winapi Functions quickly and without data types


wolf9228
 Share

Recommended Posts

With this code, Windows functions can be called without using types of Data ... Only need distinguish the int data type and the FLOAT data type

This code calls functions that include data types of no more than 32 bit ...  function that includes 64-bit parameters cannot be called through this code ... Thank you.

The functions are called in three languages, assembly language, C ++, and autoit

Call_without_data_types.zip

 

Call_without_data_types.au3

;With this code, Windows functions can be called without using types
;of Data ... Only need distinguish the int data type and the FLOAT data type

;This code calls functions that include data types of no more than
;32 bit ...  function that includes 64-bit parameters cannot be called
;through this code ... Thank you.

; FCall($Address,$PmCount,$ParmA = 0, $ParmB = 0
; Address : Address Of Function /// $PmCount : parameters Count /// ($ParmA = 0, $ParmB = 0 ....) parameters

;P() Get String From String Ptr
;S() Get String Ptr From String
;F() Get Float Number In Dword Data Type
;D() Get Dword Number In FLOAT Data Type
;RfS() Create Struct Of Ref
;RfP() Get Ref Ptr
;RfD() Get Ref Data with original data type Or with DWORD Data Type
;RtD() conveort Data Type of Return Data

Global $MaxGlobal = 40 , $GlobalStNum = 1 , $GlobalStArray[$MaxGlobal][2]
Global $RfSA = RfS(),$RfSB = RfS(),$RfSC = RfS(),$RfSD = RfS(),$RfSE = RfS(),$RfSF = RfS()
Global $RfPA = RfP($RfSA) , $RfPB = RfP($RfSB)  , $RfPC = RfP($RfSC)  , $RfPD = RfP($RfSD)
Global $RfPE = RfP($RfSE),$RfPF = RfP($RfSF)

Global _
$tagCallstruct = "DWORD ParameA;DWORD ParameB;DWORD ParameC;DWORD ParameD;" & _
"DWORD ParameE;DWORD ParameF;DWORD ParameG;DWORD ParameH;DWORD ParameI;" & _
"DWORD ParameJ;DWORD ParameK;DWORD ParameL;DWORD ParameM;DWORD ParameN;" & _
"DWORD ParameO;DWORD ParameP;DWORD nReturn;DWORD PmCount;DWORD IsCallg;"  & _
"DWORD ClosThd;DWORD TheadId;PTR Address;PTR hThread"

Global $CLB  = LoadLibrary("callWithoutDataTypes.dll")
Global $Call_LB  = DllOpen("callWithoutDataTypes.dll")
Global $wkernel32  =  GetModuleHandle( "kernel32.dll")

Global $GAdd =  GtAdd($wkernel32 ,"GetProcAddress")
Global $GMhn = GtAdd($wkernel32,"GetModuleHandleW")

Global $LoLb = GtAdd($wkernel32,"LoadLibraryW")
Global $ClHd = GtAdd($wkernel32 ,"CloseHandle")
Global $Free = GtAdd($wkernel32 ,"FreeLibrary")

Global $Wstr = GAdd("msvcrt.dll","wcslen")
Global $Astr = GAdd("msvcrt.dll","strlen")
Global $iCStruct = CallStartUp()

Func CallStartUp()
$CStruct = DllStructCreate($tagCallstruct)
$Return = DllCall($Call_LB,"BOOL","StartUp","STRUCT*",$CStruct)
if ($Return[0]) Then Return $CStruct
Return 0
EndFunc

Func CallShutdown($CStruct)
DllStructSetData($CStruct,20,1)
While DllStructGetData($CStruct,20)
WEnd
Return CloseHandle(DllStructGetData($CStruct,23))
EndFunc

Func FCall($Address,$PmCount,$ParmA = 0, $ParmB = 0,$ParmC = 0 ,$ParmD = 0, _
$ParmE = 0,$ParmF = 0,$ParmG = 0,$ParmH = 0,$ParmI = 0,$ParmJ = 0,$ParmK = 0,$ParmL = 0 _
,$ParmM = 0,$ParmN = 0,$ParmO = 0,$ParmP = 0)

; FCall($Address,$PmCount,$ParmA = 0, $ParmB = 0
; Address : Address Of Function /// $PmCount : parameters Count /// ($ParmA = 0, $ParmB = 0 ....) parameters

Switch $PmCount
Case 01
DllStructSetData($iCStruct,1,$ParmA)
Case 02
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
Case 03
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
Case 04
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
DllStructSetData($iCStruct,4,$ParmD)
Case 05
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
DllStructSetData($iCStruct,4,$ParmD)
DllStructSetData($iCStruct,5,$ParmE)
Case 06
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
DllStructSetData($iCStruct,4,$ParmD)
DllStructSetData($iCStruct,5,$ParmE)
DllStructSetData($iCStruct,6,$ParmF)
Case 07
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
DllStructSetData($iCStruct,4,$ParmD)
DllStructSetData($iCStruct,5,$ParmE)
DllStructSetData($iCStruct,6,$ParmF)
DllStructSetData($iCStruct,7,$ParmG)
Case 08
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
DllStructSetData($iCStruct,4,$ParmD)
DllStructSetData($iCStruct,5,$ParmE)
DllStructSetData($iCStruct,6,$ParmF)
DllStructSetData($iCStruct,7,$ParmG)
DllStructSetData($iCStruct,8,$ParmH)
Case 09
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
DllStructSetData($iCStruct,4,$ParmD)
DllStructSetData($iCStruct,5,$ParmE)
DllStructSetData($iCStruct,6,$ParmF)
DllStructSetData($iCStruct,7,$ParmG)
DllStructSetData($iCStruct,8,$ParmH)
DllStructSetData($iCStruct,9,$ParmI)
Case 10
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
Case 11
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
DllStructSetData($iCStruct,11,$ParmK)
Case 12
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
DllStructSetData($iCStruct,11,$ParmK)
DllStructSetData($iCStruct,12,$ParmL)
Case 13
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
DllStructSetData($iCStruct,11,$ParmK)
DllStructSetData($iCStruct,12,$ParmL)
DllStructSetData($iCStruct,13,$ParmM)
Case 14
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
DllStructSetData($iCStruct,11,$ParmK)
DllStructSetData($iCStruct,12,$ParmL)
DllStructSetData($iCStruct,13,$ParmM)
DllStructSetData($iCStruct,14,$ParmN)
Case 15
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
DllStructSetData($iCStruct,11,$ParmK)
DllStructSetData($iCStruct,12,$ParmL)
DllStructSetData($iCStruct,13,$ParmM)
DllStructSetData($iCStruct,14,$ParmN)
DllStructSetData($iCStruct,15,$ParmO)
Case 16
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
DllStructSetData($iCStruct,11,$ParmK)
DllStructSetData($iCStruct,12,$ParmL)
DllStructSetData($iCStruct,13,$ParmM)
DllStructSetData($iCStruct,14,$ParmN)
DllStructSetData($iCStruct,15,$ParmO)
DllStructSetData($iCStruct,16,$ParmP)
EndSwitch

DllStructSetData($iCStruct,22,$Address)
DllStructSetData($iCStruct,18,$PmCount)
DllStructSetData($iCStruct,19,1)

While DllStructGetData($iCStruct,19)
WEnd

Return DllStructGetData($iCStruct,17)

EndFunc

Func RfS() ; Create Struct Of Ref
Return DllStructCreate("Byte[8]") ; 8 Bytes 64 bit
;8 or 4 bytes will be copied while calling functions or less than
;two bytes and one byte.
EndFunc

Func RfP($RfStu) ; Get Ref Ptr
Return DllStructGetPtr($RfStu)
EndFunc

Func RtD($RfPtr,$DType) ; conveort Data Type of Return Data
;Just if you want to return it to its original data type, it is
;possible to use it without returning it via the API functions
Return DllStructGetData(DllStructCreate($DType,$RfPtr),1)
EndFunc

Func RfD($RfPtr,$DType = "DWORD") ; Get Ref Data with original data type Or with DWORD Data Type
;Just if you want to return it to its original data type, use $DType parameter .... it is
;possible to use it without returning it .... via the API functions
;This information, except for 64 bit data types, where this type of data must be returned
;to its origin, it is more than the size Of DWORD
Return DllStructGetData(DllStructCreate($DType,$RfPtr),1)
EndFunc

Func F($Parm) ; Get Float Number In Dword Data Type
$sParmA = DllStructCreate("FLOAT")
DllStructSetData($sParmA,1,$Parm)
Return DllStructGetData(DllStructCreate("DWORD",DllStructGetPtr($sParmA)),1)
EndFunc

Func D($Parm) ; Get Dword Number In FLOAT Data Type
$sParmA = DllStructCreate("DWORD")
DllStructSetData($sParmA,1,$Parm)
Return DllStructGetData(DllStructCreate("FLOAT",DllStructGetPtr($sParmA)),1)
EndFunc

Func S($Parm,$UNICODE = False) ; Get String Ptr From String
$Len = StringLen($Parm) + 1
Select
Case $UNICODE = False
$sParm = DllStructCreate("char[" & $Len & "]")
DllStructSetData($sParm,1,$Parm)
Return StructSetGlobal($sParm)
Case $UNICODE = True
$sParm = DllStructCreate("wchar[" & $Len & "]")
DllStructSetData($sParm,1,$Parm)
Return StructSetGlobal($sParm)
EndSelect
EndFunc

Func P($Parm,$UNICODE = False) ; Get String From String Ptr
Select
Case $UNICODE = False
$Len = FCall($Astr,1,$Parm) ;Call strlen
Return DllStructGetData(DllStructCreate("char[" & $Len + 1 & "]",$Parm),1)
Case $UNICODE = True
$Len = FCall($Wstr,1,$Parm) ; Call wcslen
Return DllStructGetData(DllStructCreate("wchar[" & $Len + 1 & "]",$Parm),1)
EndSelect
EndFunc

Func StructSetGlobal($Struct)
; StructSetGlobal
;You can Set 40 Structs before deleting the first Struct /// $MaxGlobal = 40
Switch $GlobalStNum
Case $MaxGlobal
$StPtr = DllStructGetPtr($Struct)
$GlobalStArray[$GlobalStNum - 1][0] = $Struct
$GlobalStArray[$GlobalStNum - 1][1] = $StPtr
$GlobalStNum = 1
Return $StPtr
Case Else
$StPtr = DllStructGetPtr($Struct)
$GlobalStArray[$GlobalStNum - 1][0] = $Struct
$GlobalStArray[$GlobalStNum - 1][1] = $StPtr
$GlobalStNum += 1
Return $StPtr
EndSwitch
EndFunc

Func FreeSetG($StPtr) ; Free StructSetGlobal($Struct)
For $cNum = 0 To 39
if $GlobalStArray[$cNum][1] = $StPtr Then
$GlobalStArray[$cNum][0] = ""
Return True
EndIf
Next
Return False
EndFunc

Func GAdd($ModuleName,$FuncName) ;Quick call
Return GetAddress(GetModuleH($ModuleName),$FuncName)
EndFunc

Func GetAddress($hModule,$lpProcName) ;Quick call
$FARPROC = DllCallAddress("ptr",$GAdd,"ptr",$hModule,"str",$lpProcName)
Return $FARPROC[0]
EndFunc

Func GetModuleH($lpModuleName) ;Quick call
$HMODULE = DllCallAddress("ptr",$GMhn,"wstr",$lpModuleName)
Return $HMODULE[0]
EndFunc

Func GetModuleHandle($lpModuleName) ; Slow call
$DType = "wstr"
if IsInt($lpModuleName) Then $DType = "int"
$HMODULE = DllCall("kernel32.dll","ptr","GetModuleHandleW",$DType,$lpModuleName)
Return $HMODULE[0]
EndFunc

Func GtAdd($hModule,$lpProcName) ;Slow call
$FARPROC = DllCall("kernel32.dll","ptr","GetProcAddress","ptr",$hModule,"str",$lpProcName)
Return $FARPROC[0]
EndFunc

Func Load_Library($lpLibFileName) ;Quick call
$HMODULE = DllCallAddress("ptr",$LoLb,"wstr",$lpLibFileName)
Return $HMODULE[0]
EndFunc

Func LoadLibrary($lpLibFileName) ;Slow call
$HMODULE = DllCall("kernel32.dll","ptr","LoadLibraryW","wstr",$lpLibFileName)
Return $HMODULE[0]
EndFunc

Func FreeLibrary($hLibModule)
$Return = DllCall("kernel32.dll","BOOL","FreeLibrary","ptr",$hLibModule)
Return $Return[0]
EndFunc

Func CloseHandle($hObject) ;Quick call
$Return = DllCallAddress("BOOL",$ClHd,"ptr",$hObject)
Return $Return[0]
EndFunc

Example.au3

#include "Call_without_data_types.au3"

;With this code, Windows functions can be called without using types
;of Data ... Only need distinguish the int data type and the FLOAT data type

;This code calls functions that include data types of no more than
;32 bit ...  function that includes 64-bit parameters cannot be called
;through this code ... Thank you.

; FCall($Address,$PmCount,$ParmA = 0, $ParmB = 0
; Address : Address Of Function /// $PmCount : parameters Count /// ($ParmA = 0, $ParmB = 0 ....) parameters

;P() Get String From String Ptr
;S() Get String Ptr From String
;F() Get Float Number In Dword Data Type
;D() Get Dword Number In FLOAT Data Type
;RfS() Create Struct Of Ref
;RfP() Get Ref Ptr
;RfD() Get Ref Data with original data type Or with DWORD Data Type
;RtD() conveort Data Type of Return Data

$Usr32 = FCall($GMhn  , 1  , S("User32.dll",True)) ; LoadLibraryW(User32.dll) S("User32.dll",True)) UNICODE string
$cMsgB = FCall($GAdd ,2 , $Usr32,S("MessageBoxA")) ; GetProcAddress(MessageBoxA) // S("MessageBoxA") ANSI string
$Gewrt = FCall($GAdd,2 ,$Usr32,S("GetWindowRect")) ; GetProcAddress(GetWindowRect)
$GPlus = FCall($LoLb,1,S("gdiplus.dll",True)) ; LoadLibraryW(gdiplus.dll)
$StaUp = FCall($GAdd,2,$GPlus,S("GdiplusStartup")) ; GetProcAddress(GdiplusStartup)
$CFotF = FCall($GAdd,2,$GPlus,S("GdipCreateFontFamilyFromName")) ; GetProcAddress(GdipCreateFontFamilyFromName)
$CFont = FCall($GAdd,2 ,$GPlus,S("GdipCreateFont")) ; GetProcAddress(GdipCreateFont)
$FSize = FCall($GAdd,2,$GPlus,S("GdipGetFontSize")) ; GetProcAddress(GdipGetFontSize)
$Gdpsh = FCall($GAdd,2,$GPlus,S("GdiplusShutdown")) ; GetProcAddress(GdiplusShutdown)
$FDelt = FCall($GAdd,2,$GPlus,S("GdipDeleteFont")) ; GetProcAddress(GdipDeleteFont)
$FFDlt = FCall($GAdd,2,$GPlus,S("GdipDeleteFontFamily")) ; GetProcAddress(GdipDeleteFontFamily)

$toupr = GAdd("msvcrt.dll","toupper") ; GetProcAddress For toupper

Example()

Func Example()

$Return = FCall($cMsgB,4,0,S("Autoit"),S("Msg"),0x00000001) ; Call MessageBoxA
$Return = "Return Of MessageBoxA Is " & $Return
FCall($cMsgB,4,0,S($Return),S("Msg"),0) ; Call MessageBoxA

$toupper = FCall($toupr,1,97) ; Asc("a") = 97
$toupper = "a = 97 toupper A = " & $toupper
FCall($cMsgB,4,0,S($toupper),S("Msg"),0) ; Call MessageBoxA

$Gui = GUICreate("Gui",200,200,100,100)
GUISetState(@SW_SHOW)

Sleep(100)

$tagRECT = "LONG left;LONG top;LONG right;LONG bottom"
$Rect = DllStructCreate($tagRECT)

$BOOL = FCall($Gewrt,2,$Gui,DllStructGetPtr($Rect)) ;Call GetWindowRect

Local $L = DllStructGetData($Rect,1)
Local $T = DllStructGetData($Rect,2)
Local $W = DllStructGetData($Rect,3) - $L
Local $H = DllStructGetData($Rect,4) - $T

FCall($cMsgB,4,0,S("L " & $L & " T " & $T & " W " & $W & " H " & $H),S("Msg"),0) ; Call MessageBoxA

GUIDelete($Gui)

$tegGpsInput = _
"UINT GdiplusVersion;" & _
"PTR  DebugEventCallback;" & _
"BOOL SuppressBackgroundThread;" & _
"BOOL SuppressExternalCodecs;"
$IpSt = DllStructCreate($tegGpsInput)
DllStructSetData($IpSt,"GdiplusVersion",1)
DllStructSetData($IpSt,"DebugEventCallback",0)
DllStructSetData($IpSt,"SuppressBackgroundThread",0)
DllStructSetData($IpSt,"SuppressExternalCodecs",0)
$IpPtr = DllStructGetPtr($IpSt)

$Stats = FCall($StaUp,3,$RfPA,$IpPtr,0) ; Call GdiplusStartup
$Stats = FCall($CFotF,3,S("Arial",True),0,$RfPB) ; Call GdipCreateFontFamilyFromName
$Stats = FCall($CFont,5,RfD($RfPB),F(5.5),0,3,$RfPC) ; Call GdipCreateFont Create Font Size Is 5.5
;F(5.5) FLOAT values must be converted to DWORD equivalent because the call is made to a DWORD value
$Stats = FCall($FSize,2,RfD($RfPC),$RfPD) ; Call GdipGetFontSize

FCall($cMsgB,4,0,S("Get Font Size Is " & RfD($RfPD,"FLOAT")),S("Msg"),0) ; Call MessageBoxA
;RfD($RfPC,"FLOAT") Get Ref Data with original FLOAT Data Type

$Stats = FCall($FDelt,1,RfD($RfPC)) ; call GdipDeleteFont
$Stats = FCall($FFDlt,1,RfD($RfPB)) ; call GdipDeleteFontFamily
$Stats = FCall($Gdpsh,1,$RfPA) ; Call GdiplusShutdown
$yBOOL = FCall($Free,1,$Usr32) ; Call FreeLibrary
$nBOOL = FCall($Free,1,$GPlus) ; Call FreeLibrary

EndFunc

compilers.au3

Free C++ Compiler
https://www.autoitscript.com/forum/topic/202283-free-c-compiler/?tab=comments#comment-1451481

;https://www.embarcadero.com/free-tools/ccompiler
;Free C++ Compiler
;The BCC32C/BCC32X Compiler is the high performance foundation and core technology of Embarcadero's
;award-winning C++Builder product line.

;This free download of the C++ Compiler for C++Builder includes C11 language support, the Dinkumware STL
;(Standard Template Library) framework, and the complete Embarcadero C/C++ Runtime Library (RTL). In this
;free version, you’ll also find a number of C/C++ command line tools—such as the high-performance linker
;and resource compiler.

;The Free C++ Compiler download includes:

    ;Embarcadero C++ Compiler (bcc32c/bcc32x)
    ;Turbo Incremental Linker (tlink32)
    ;C++ Win32 Preprocessor (cpp32)
    ;Import Library utility—for creating import libraries from DLLs (implib)
    ;Librarian for symbol case-conversion, creating extended libraries and modifying page size (tlib)
    ;Other useful command-line utilities such as make, grep, and touch
    ;Includes the Embarcadero C/C++ Runtime Library, and the DinkumwareANSI/ISO Standard Template Library (STL)

;bcc32c-101-Berlin-screenshot

;C++Builder includes compilers for Win64, macOS, iOS, and Android. And, C++Builder also features a modern,
;high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform
;UI development. Learn more about RAD Studio on its product page.
;C++ is avilable in three editions - Free, Community or Pro/Enterprise/Architect.

Global $VisualStyles = True , $BCC102 = "D:\BCC102", $compExe = "bcc32c.exe" ; $compExe compiled Exe File Name
Global $PFile = $BCC102 & "\yProject.cpp" ; C++ File
Global $NewFile = "callWithoutDataTypes" ; New Out File
Global $Exe_Dll = 2 ; /// 1 Exe File /// 2 Dll File // Else Numbers Choose One

Switch $Exe_Dll
Case 1
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
Case 2
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
Case Else
$Gui = GUICreate("compiled", 210 + 150, 80)
GUICtrlCreateLabel("Please Choose One!", 10, 10)
$Exe = GUICtrlCreateButton("Exe File", 10, 50, 100, 23)
$DLL = GUICtrlCreateButton("Dll File", 80 + 50, 50, 100, 23)
$Ext = GUICtrlCreateButton("Exit", 150 + 100, 50, 100, 23)
GUISetState()
While 1
$iMsg = GUIGetMsg()
Select
Case $iMsg = $Exe
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
ExitLoop
Case $iMsg = $DLL
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
ExitLoop
Case $iMsg = -3 Or $iMsg = $Ext ; $GUI_EVENT_CLOSE = -3
Exit
EndSelect
WEnd
GUIDelete($Gui)
EndSwitch

$Dir = @ScriptDir
$yCompiled_File = $BCC102 & "\Bin\" & $compExe

if Not FileExists($yCompiled_File) Then $BCC102 = FileSelectFolder("Choose BCC102","C:\")
if @error Then Exit
if Not FileExists($PFile) Then $PFile = FileOpenDialog("Choose C++ File",$Dir,"(*.cpp)",5)
if @error Then Exit

$NewFile &= $FType
FileChangeDir($BCC102)
$PFile = FileGetShortName($PFile)

$Command = "Bin\" & $compExe & $TCod & "-IInclude -LLib -e" & $NewFile & $PFile & @CRLF & "Pause"

if FileExists("Batch.bat") And Not FileDelete("Batch.bat") Then Exit

FileWrite("Batch.bat",$Command)

RunWait("Batch.bat")

if $VisualStyles Then

;Enabling Visual Styles
;https://docs.microsoft.com/en-us/windows/win32/controls/cookbook-overview

$ManiText = _
'<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">' & @CRLF & _
'<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">' & @CRLF & _
' <security>' & @CRLF & _
'    <requestedPrivileges>' & @CRLF & _
'    <requestedExecutionLevel level="asInvoker" uiAccess="false">'& @CRLF & _
'    </requestedExecutionLevel>' & @CRLF & _
'    </requestedPrivileges>' & @CRLF & _
' </security>' & @CRLF & _
' </trustInfo>' & @CRLF & _
' <dependency>' & @CRLF & _
' <dependentAssembly>' & @CRLF & _
'    <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" language="*" processorArchitecture="*" publicKeyToken="6595b64144ccf1df"></assemblyIdentity>' & @CRLF & _
' </dependentAssembly>' & @CRLF & _
' </dependency>' & @CRLF & _
'</assembly>'

$RT_MANIFEST = 24
$vDataStruct = StringToDataStruct($ManiText)
$vlpData =  DllStructGetPtr($vDataStruct)
$vcbData = DllStructGetSize($vDataStruct)
UpdateResource($NewFile,$RT_MANIFEST,1,$vlpData,$vcbData)

EndIf

FileDelete(@ScriptDir & "\callWithoutDataTypes.dll")
FileCopy($NewFile,@ScriptDir & "\callWithoutDataTypes.dll")

Func StringToDataStruct($Text)
$Len = StringLen($Text)
if $Len = 0 Then $Len = 1
$DataStruct = DllStructCreate("char[" & $Len & "]")
DllStructSetData($DataStruct,1,$Text)
Return $DataStruct
EndFunc

Func UpdateResource($Dll_Exe_File,$lpType,$lpName,$lpData,$cbData)

$Handle = DllCall("kernel32.dll","HANDLE","BeginUpdateResourceW","wstr",$Dll_Exe_File,"BOOL",False)
if @error Or $Handle[0] = 0 Then Return SetError(1,0,False)
$Handle = $Handle[0]

Select
Case IsString($lpType)
$DTypeA = "wstr"
$lpType = StringUpper($lpType)
Case Else
$DTypeA = "long"
$lpType = $lpType
EndSelect

Select
Case IsString($lpName)
$DTypeB = "wstr"
$lpName = StringUpper($lpName)
Case Else
$DTypeB = "long"
$lpName = $lpName
EndSelect

$BOOL = DllCall("kernel32.dll","BOOL","UpdateResourceW","HANDLE",$Handle,$DTypeA _
,$lpType,$DTypeB,$lpName,"WORD",0,"ptr",$lpData,"DWORD",$cbData)
if @error Or $BOOL[0] = 0 Then
DllCall("kernel32.dll","BOOL","EndUpdateResourceW","HANDLE",$Handle,"BOOL",False)
Return SetError(2,0,False)
EndIf

$BOOL = DllCall("kernel32.dll","BOOL","EndUpdateResourceW","HANDLE",$Handle,"BOOL",False)
if @error Or $BOOL[0] = 0 Then Return SetError(3,0,False)

Return SetError(0,0,True)

EndFunc

Call_without_data_types.cpp

#include <stdio.h>
#include <shlobj.h>

DWORD WINAPI CallThread(LPVOID nCallPtr);

typedef struct {
DWORD  ParameA;
DWORD  ParameB;
DWORD  ParameC;
DWORD  ParameD;
DWORD  ParameE;
DWORD  ParameF;
DWORD  ParameG;
DWORD  ParameH;
DWORD  ParameI;
DWORD  ParameJ;
DWORD  ParameK;
DWORD  ParameL;
DWORD  ParameM;
DWORD  ParameN;
DWORD  ParameO;
DWORD  ParameP;
DWORD  nReturn;
DWORD  PmCount;
DWORD  IsCallg;
DWORD  ClosThd;
DWORD  TheadId;
LPVOID Address;
LPVOID hThread;
}CallSt,*CallPtr;

#ifdef __cplusplus
extern "C"
{
#endif
__declspec(dllexport) BOOL WINAPI StartUp(LPVOID nCallPtr);
#ifdef __cplusplus
}
#endif

BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
        case DLL_PROCESS_ATTACH:
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        case DLL_PROCESS_DETACH:
            break;
    }

    return TRUE;
}


BOOL WINAPI StartUp(LPVOID nCallPtr)
{
CallSt* cCallPtr = (CallSt*)nCallPtr;
cCallPtr->hThread = CreateThread(NULL,0,CallThread,nCallPtr,0,&cCallPtr->TheadId);
Sleep(300);
return (cCallPtr->hThread != NULL);
}

DWORD WINAPI CallThread(LPVOID nCallPtr)
{

__asm
{

Start:

mov ebx,nCallPtr

CMP  [ebx + 76],1
JZ Out

CMP  [ebx + 72],0
JZ Start

CMP  [ebx + 68],0
JZ TA

CMP  [ebx + 68],1
JZ TB

CMP  [ebx + 68],2
JZ TC

CMP  [ebx + 68],3
JZ TD

CMP  [ebx + 68],4
JZ TE

CMP  [ebx + 68],5
JZ TF

CMP  [ebx + 68],6
JZ TG

CMP  [ebx + 68],7
JZ TH

CMP  [ebx + 68],8
JZ TI

CMP  [ebx + 68],9
JZ TJ

CMP [ebx + 68],10
JZ TK

CMP [ebx + 68],11
JZ TL

CMP [ebx + 68],12
JZ TM

CMP [ebx + 68],13
JZ TN

CMP [ebx + 68],14
JZ TO

CMP [ebx + 68],15
JZ TP

CMP [ebx + 68],16
JZ TQ

mov [ebx + 72],0
JMP Start

TA:
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TB:
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TC:
push DWORD PTR[ebx + 4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TD:
push DWORD PTR[ebx + 8]
push DWORD PTR[ebx + 4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TE:
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TF:
push DWORD PTR[ebx + 16]
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TG:
push DWORD PTR[ebx + 20]
push DWORD PTR[ebx + 16]
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TH:
push DWORD PTR[ebx + 24]
push DWORD PTR[ebx + 20]
push DWORD PTR[ebx + 16]
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TI:
push DWORD PTR[ebx + 28]
push DWORD PTR[ebx + 24]
push DWORD PTR[ebx + 20]
push DWORD PTR[ebx + 16]
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TJ:
push DWORD PTR[ebx + 32]
push DWORD PTR[ebx + 28]
push DWORD PTR[ebx + 24]
push DWORD PTR[ebx + 20]
push DWORD PTR[ebx + 16]
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TK:
push DWORD PTR[ebx + 36]
push DWORD PTR[ebx + 32]
push DWORD PTR[ebx + 28]
push DWORD PTR[ebx + 24]
push DWORD PTR[ebx + 20]
push DWORD PTR[ebx + 16]
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TL:
push DWORD PTR[ebx + 40]
push DWORD PTR[ebx + 36]
push DWORD PTR[ebx + 32]
push DWORD PTR[ebx + 28]
push DWORD PTR[ebx + 24]
push DWORD PTR[ebx + 20]
push DWORD PTR[ebx + 16]
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TM:
push DWORD PTR[ebx + 44]
push DWORD PTR[ebx + 40]
push DWORD PTR[ebx + 36]
push DWORD PTR[ebx + 32]
push DWORD PTR[ebx + 28]
push DWORD PTR[ebx + 24]
push DWORD PTR[ebx + 20]
push DWORD PTR[ebx + 16]
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TN:
push DWORD PTR[ebx + 48]
push DWORD PTR[ebx + 44]
push DWORD PTR[ebx + 40]
push DWORD PTR[ebx + 36]
push DWORD PTR[ebx + 32]
push DWORD PTR[ebx + 28]
push DWORD PTR[ebx + 24]
push DWORD PTR[ebx + 20]
push DWORD PTR[ebx + 16]
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TO:
push DWORD PTR[ebx + 52]
push DWORD PTR[ebx + 48]
push DWORD PTR[ebx + 44]
push DWORD PTR[ebx + 40]
push DWORD PTR[ebx + 36]
push DWORD PTR[ebx + 32]
push DWORD PTR[ebx + 28]
push DWORD PTR[ebx + 24]
push DWORD PTR[ebx + 20]
push DWORD PTR[ebx + 16]
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TP:
push DWORD PTR[ebx + 56]
push DWORD PTR[ebx + 52]
push DWORD PTR[ebx + 48]
push DWORD PTR[ebx + 44]
push DWORD PTR[ebx + 40]
push DWORD PTR[ebx + 36]
push DWORD PTR[ebx + 32]
push DWORD PTR[ebx + 28]
push DWORD PTR[ebx + 24]
push DWORD PTR[ebx + 20]
push DWORD PTR[ebx + 16]
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

TQ:
push DWORD PTR[ebx + 60]
push DWORD PTR[ebx + 56]
push DWORD PTR[ebx + 52]
push DWORD PTR[ebx + 48]
push DWORD PTR[ebx + 44]
push DWORD PTR[ebx + 40]
push DWORD PTR[ebx + 36]
push DWORD PTR[ebx + 32]
push DWORD PTR[ebx + 28]
push DWORD PTR[ebx + 24]
push DWORD PTR[ebx + 20]
push DWORD PTR[ebx + 16]
push DWORD PTR[ebx + 12]
push DWORD PTR[ebx +  8]
push DWORD PTR[ebx +  4]
push DWORD PTR[ebx]
call [ebx + 84]
mov [ebx + 64],eax
mov [ebx + 72],0
JMP Start

Out:
mov [ebx + 76],0

};

return 1;

}

 

Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

Nice, but the code for

Switch $PmCount

could be replaced with more compact code:

For $i = 1 To $PmCount
    DllStructSetData($iCStruct, $i, Eval('Parm' & Chr($i + 64)))
Next

 

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

5 hours ago, MrCreatoR said:

Nice, but the code for


Switch $PmCount

could be replaced with more compact code:

For $i = 1 To $PmCount
    DllStructSetData($iCStruct, $i, Eval('Parm' & Chr($i + 64)))
Next

 

 

Hello, thanks for interacting ... test this code.
Global _
$tagCallstruct = "DWORD ParameA;DWORD ParameB;DWORD ParameC;DWORD ParameD;" & _
"DWORD ParameE;DWORD ParameF;DWORD ParameG;DWORD ParameH;DWORD ParameI;" & _
"DWORD ParameJ;DWORD ParameK;DWORD ParameL;DWORD ParameM;DWORD ParameN;" & _
"DWORD ParameO;DWORD ParameP;DWORD nReturn;DWORD PmCount;DWORD IsCallg;"  & _
"DWORD ClosThd;DWORD TheadId;PTR Address;PTR hThread"

$iCStruct = DllStructCreate($tagCallstruct)

MsgBox(0,"Msg","OK")

$hTimerA = TimerInit()
For $j = 0 To 100000
nFCall(0x0000,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
Next
$fDiffA = TimerDiff($hTimerA)

$iCStruct = DllStructCreate($tagCallstruct)
MsgBox(0,"Msg","OK")

$hTimerB = TimerInit()
For $j = 0 To 100000
yFCall(0x0000,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
Next
$fDiffB = TimerDiff($hTimerB)

MsgBox(0,"", $fDiffA & @CRLF & $fDiffB)

Func yFCall($Address,$PmCount,$ParmA = 0, $ParmB = 0,$ParmC = 0 ,$ParmD = 0, _
$ParmE = 0,$ParmF = 0,$ParmG = 0,$ParmH = 0,$ParmI = 0,$ParmJ = 0,$ParmK = 0,$ParmL = 0 _
,$ParmM = 0,$ParmN = 0,$ParmO = 0,$ParmP = 0)


For $i = 1 To $PmCount
    DllStructSetData($iCStruct, $i, Eval('Parm' & Chr($i + 64)))
Next

EndFunc

Func nFCall($Address,$PmCount,$ParmA = 0, $ParmB = 0,$ParmC = 0 ,$ParmD = 0, _
$ParmE = 0,$ParmF = 0,$ParmG = 0,$ParmH = 0,$ParmI = 0,$ParmJ = 0,$ParmK = 0,$ParmL = 0 _
,$ParmM = 0,$ParmN = 0,$ParmO = 0,$ParmP = 0)

; FCall($Address,$PmCount,$ParmA = 0, $ParmB = 0
; Address : Address Of Function /// $PmCount : parameters Count /// ($ParmA = 0, $ParmB = 0 ....) parameters

Switch $PmCount
Case 01
DllStructSetData($iCStruct,1,$ParmA)
Case 02
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
Case 03
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
Case 04
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
DllStructSetData($iCStruct,4,$ParmD)
Case 05
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
DllStructSetData($iCStruct,4,$ParmD)
DllStructSetData($iCStruct,5,$ParmE)
Case 06
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
DllStructSetData($iCStruct,4,$ParmD)
DllStructSetData($iCStruct,5,$ParmE)
DllStructSetData($iCStruct,6,$ParmF)
Case 07
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
DllStructSetData($iCStruct,4,$ParmD)
DllStructSetData($iCStruct,5,$ParmE)
DllStructSetData($iCStruct,6,$ParmF)
DllStructSetData($iCStruct,7,$ParmG)
Case 08
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
DllStructSetData($iCStruct,4,$ParmD)
DllStructSetData($iCStruct,5,$ParmE)
DllStructSetData($iCStruct,6,$ParmF)
DllStructSetData($iCStruct,7,$ParmG)
DllStructSetData($iCStruct,8,$ParmH)
Case 09
DllStructSetData($iCStruct,1,$ParmA)
DllStructSetData($iCStruct,2,$ParmB)
DllStructSetData($iCStruct,3,$ParmC)
DllStructSetData($iCStruct,4,$ParmD)
DllStructSetData($iCStruct,5,$ParmE)
DllStructSetData($iCStruct,6,$ParmF)
DllStructSetData($iCStruct,7,$ParmG)
DllStructSetData($iCStruct,8,$ParmH)
DllStructSetData($iCStruct,9,$ParmI)
Case 10
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
Case 11
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
DllStructSetData($iCStruct,11,$ParmK)
Case 12
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
DllStructSetData($iCStruct,11,$ParmK)
DllStructSetData($iCStruct,12,$ParmL)
Case 13
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
DllStructSetData($iCStruct,11,$ParmK)
DllStructSetData($iCStruct,12,$ParmL)
DllStructSetData($iCStruct,13,$ParmM)
Case 14
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
DllStructSetData($iCStruct,11,$ParmK)
DllStructSetData($iCStruct,12,$ParmL)
DllStructSetData($iCStruct,13,$ParmM)
DllStructSetData($iCStruct,14,$ParmN)
Case 15
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
DllStructSetData($iCStruct,11,$ParmK)
DllStructSetData($iCStruct,12,$ParmL)
DllStructSetData($iCStruct,13,$ParmM)
DllStructSetData($iCStruct,14,$ParmN)
DllStructSetData($iCStruct,15,$ParmO)
Case 16
DllStructSetData($iCStruct,1, $ParmA)
DllStructSetData($iCStruct,2, $ParmB)
DllStructSetData($iCStruct,3, $ParmC)
DllStructSetData($iCStruct,4, $ParmD)
DllStructSetData($iCStruct,5, $ParmE)
DllStructSetData($iCStruct,6, $ParmF)
DllStructSetData($iCStruct,7, $ParmG)
DllStructSetData($iCStruct,8, $ParmH)
DllStructSetData($iCStruct,9, $ParmI)
DllStructSetData($iCStruct,10,$ParmJ)
DllStructSetData($iCStruct,11,$ParmK)
DllStructSetData($iCStruct,12,$ParmL)
DllStructSetData($iCStruct,13,$ParmM)
DllStructSetData($iCStruct,14,$ParmN)
DllStructSetData($iCStruct,15,$ParmO)
DllStructSetData($iCStruct,16,$ParmP)
EndSwitch


EndFunc

 

Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

Ok i see your point.

What about this:

For $i = 1 To $PmCount
    $iCStruct($i) = Eval('Parm' & Chr($i + 64))
Next

:whistle:

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

11 minutes ago, MrCreatoR said:

Ok i see your point.

What about this:

For $i = 1 To $PmCount
    $iCStruct($i) = Eval('Parm' & Chr($i + 64))
Next

:whistle:

 

The important thing is the speed of executing the code ... using the loop takes time in addition to that, the Eval function takes additional time, some programming operations such as downloading files from the network require successive Calls, reaching thousands of thousands ... here ... the difference in time between and between will be great, thanks.

صرح السماء كان هنا

 

Link to comment
Share on other sites

1 minute ago, wolf9228 said:

The important thing is the speed of executing the code

I know, but did you tried with $iCStruct($i)? It's faster.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

@MrCreatoR how do you deduct that will work? Are you sure you'll get the value assigned accessing in that way to the structure?

Btw nice share wolf 🤘

Saludos

Link to comment
Share on other sites

1 minute ago, Danyfirex said:

how do you deduct that will work? Are you sure you'll get the value assigned accessing in that way to the structure?

Yes i have checked that before posting.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

What AutoIt version you're using? It work for me (don't show issue) but I don't get the structure filled out.

 

Saludos

Link to comment
Share on other sites

Strange, when i checked that in the speed test example i was sure it's fills the structure, apparently i did something wrong.

I assumed that since $tStruct.Param usage allowed in AutoIt, it should work as COM objects.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Btw, this method faster:

 

Global _
        $tagCallstruct = "DWORD ParameA;DWORD ParameB;DWORD ParameC;DWORD ParameD;" & _
        "DWORD ParameE;DWORD ParameF;DWORD ParameG;DWORD ParameH;DWORD ParameI;" & _
        "DWORD ParameJ;DWORD ParameK;DWORD ParameL;DWORD ParameM;DWORD ParameN;" & _
        "DWORD ParameO;DWORD ParameP;DWORD nReturn;DWORD PmCount;DWORD IsCallg;" & _
        "DWORD ClosThd;DWORD TheadId;PTR Address;PTR hThread"

$iCStruct = DllStructCreate($tagCallstruct)

MsgBox(0, "Msg", "OK")

$hTimerA = TimerInit()
For $i = 0 To 100000
    aFCall(0x0000, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Next
$fDiffA = TimerDiff($hTimerA)

$iCStruct = DllStructCreate($tagCallstruct)
MsgBox(0, "Msg", "OK")

$hTimerB = TimerInit()
For $i = 0 To 100000
    bFCall(0x0000, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Next
$fDiffB = TimerDiff($hTimerB)

MsgBox(0, "", $fDiffA & @CRLF & $fDiffB)

Func aFCall($Address, $PmCount, $ParmA = 0, $ParmB = 0, $ParmC = 0, $ParmD = 0, _
            $ParmE = 0, $ParmF = 0, $ParmG = 0, $ParmH = 0, $ParmI = 0, $ParmJ = 0, $ParmK = 0, $ParmL = 0 _
            , $ParmM = 0, $ParmN = 0, $ParmO = 0, $ParmP = 0)
    
    ; FCall($Address,$PmCount,$ParmA = 0, $ParmB = 0
    ; Address : Address Of Function /// $PmCount : parameters Count /// ($ParmA = 0, $ParmB = 0 ....) parameters
    
    Switch $PmCount
        Case 01
            DllStructSetData($iCStruct, 1, $ParmA)
        Case 02
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
        Case 03
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
        Case 04
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
        Case 05
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
            DllStructSetData($iCStruct, 5, $ParmE)
        Case 06
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
            DllStructSetData($iCStruct, 5, $ParmE)
            DllStructSetData($iCStruct, 6, $ParmF)
        Case 07
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
            DllStructSetData($iCStruct, 5, $ParmE)
            DllStructSetData($iCStruct, 6, $ParmF)
            DllStructSetData($iCStruct, 7, $ParmG)
        Case 08
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
            DllStructSetData($iCStruct, 5, $ParmE)
            DllStructSetData($iCStruct, 6, $ParmF)
            DllStructSetData($iCStruct, 7, $ParmG)
            DllStructSetData($iCStruct, 8, $ParmH)
        Case 09
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
            DllStructSetData($iCStruct, 5, $ParmE)
            DllStructSetData($iCStruct, 6, $ParmF)
            DllStructSetData($iCStruct, 7, $ParmG)
            DllStructSetData($iCStruct, 8, $ParmH)
            DllStructSetData($iCStruct, 9, $ParmI)
        Case 10
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
            DllStructSetData($iCStruct, 5, $ParmE)
            DllStructSetData($iCStruct, 6, $ParmF)
            DllStructSetData($iCStruct, 7, $ParmG)
            DllStructSetData($iCStruct, 8, $ParmH)
            DllStructSetData($iCStruct, 9, $ParmI)
            DllStructSetData($iCStruct, 10, $ParmJ)
        Case 11
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
            DllStructSetData($iCStruct, 5, $ParmE)
            DllStructSetData($iCStruct, 6, $ParmF)
            DllStructSetData($iCStruct, 7, $ParmG)
            DllStructSetData($iCStruct, 8, $ParmH)
            DllStructSetData($iCStruct, 9, $ParmI)
            DllStructSetData($iCStruct, 10, $ParmJ)
            DllStructSetData($iCStruct, 11, $ParmK)
        Case 12
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
            DllStructSetData($iCStruct, 5, $ParmE)
            DllStructSetData($iCStruct, 6, $ParmF)
            DllStructSetData($iCStruct, 7, $ParmG)
            DllStructSetData($iCStruct, 8, $ParmH)
            DllStructSetData($iCStruct, 9, $ParmI)
            DllStructSetData($iCStruct, 10, $ParmJ)
            DllStructSetData($iCStruct, 11, $ParmK)
            DllStructSetData($iCStruct, 12, $ParmL)
        Case 13
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
            DllStructSetData($iCStruct, 5, $ParmE)
            DllStructSetData($iCStruct, 6, $ParmF)
            DllStructSetData($iCStruct, 7, $ParmG)
            DllStructSetData($iCStruct, 8, $ParmH)
            DllStructSetData($iCStruct, 9, $ParmI)
            DllStructSetData($iCStruct, 10, $ParmJ)
            DllStructSetData($iCStruct, 11, $ParmK)
            DllStructSetData($iCStruct, 12, $ParmL)
            DllStructSetData($iCStruct, 13, $ParmM)
        Case 14
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
            DllStructSetData($iCStruct, 5, $ParmE)
            DllStructSetData($iCStruct, 6, $ParmF)
            DllStructSetData($iCStruct, 7, $ParmG)
            DllStructSetData($iCStruct, 8, $ParmH)
            DllStructSetData($iCStruct, 9, $ParmI)
            DllStructSetData($iCStruct, 10, $ParmJ)
            DllStructSetData($iCStruct, 11, $ParmK)
            DllStructSetData($iCStruct, 12, $ParmL)
            DllStructSetData($iCStruct, 13, $ParmM)
            DllStructSetData($iCStruct, 14, $ParmN)
        Case 15
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
            DllStructSetData($iCStruct, 5, $ParmE)
            DllStructSetData($iCStruct, 6, $ParmF)
            DllStructSetData($iCStruct, 7, $ParmG)
            DllStructSetData($iCStruct, 8, $ParmH)
            DllStructSetData($iCStruct, 9, $ParmI)
            DllStructSetData($iCStruct, 10, $ParmJ)
            DllStructSetData($iCStruct, 11, $ParmK)
            DllStructSetData($iCStruct, 12, $ParmL)
            DllStructSetData($iCStruct, 13, $ParmM)
            DllStructSetData($iCStruct, 14, $ParmN)
            DllStructSetData($iCStruct, 15, $ParmO)
        Case 16
            DllStructSetData($iCStruct, 1, $ParmA)
            DllStructSetData($iCStruct, 2, $ParmB)
            DllStructSetData($iCStruct, 3, $ParmC)
            DllStructSetData($iCStruct, 4, $ParmD)
            DllStructSetData($iCStruct, 5, $ParmE)
            DllStructSetData($iCStruct, 6, $ParmF)
            DllStructSetData($iCStruct, 7, $ParmG)
            DllStructSetData($iCStruct, 8, $ParmH)
            DllStructSetData($iCStruct, 9, $ParmI)
            DllStructSetData($iCStruct, 10, $ParmJ)
            DllStructSetData($iCStruct, 11, $ParmK)
            DllStructSetData($iCStruct, 12, $ParmL)
            DllStructSetData($iCStruct, 13, $ParmM)
            DllStructSetData($iCStruct, 14, $ParmN)
            DllStructSetData($iCStruct, 15, $ParmO)
            DllStructSetData($iCStruct, 16, $ParmP)
    EndSwitch
EndFunc

Func bFCall($Address, $PmCount, $ParmA = 0, $ParmB = 0, $ParmC = 0, $ParmD = 0, _
            $ParmE = 0, $ParmF = 0, $ParmG = 0, $ParmH = 0, $ParmI = 0, $ParmJ = 0, $ParmK = 0, $ParmL = 0 _
            , $ParmM = 0, $ParmN = 0, $ParmO = 0, $ParmP = 0)
    
    Switch $PmCount
        Case 01
            $iCStruct.ParameA = $ParmA
        Case 02
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
        Case 03
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
        Case 04
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
        Case 05
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
            $iCStruct.ParameE = $ParmE
        Case 06
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
            $iCStruct.ParameE = $ParmE
            $iCStruct.ParameF = $ParmF
        Case 07
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
            $iCStruct.ParameE = $ParmE
            $iCStruct.ParameF = $ParmF
            $iCStruct.ParameG = $ParmG
        Case 08
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
            $iCStruct.ParameE = $ParmE
            $iCStruct.ParameF = $ParmF
            $iCStruct.ParameG = $ParmG
            $iCStruct.ParameH = $ParmH
        Case 09
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
            $iCStruct.ParameE = $ParmE
            $iCStruct.ParameF = $ParmF
            $iCStruct.ParameG = $ParmG
            $iCStruct.ParameH = $ParmH
            $iCStruct.ParameI = $ParmI
        Case 10
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
            $iCStruct.ParameE = $ParmE
            $iCStruct.ParameF = $ParmF
            $iCStruct.ParameG = $ParmG
            $iCStruct.ParameH = $ParmH
            $iCStruct.ParameI = $ParmI
            $iCStruct.ParameJ = $ParmJ
        Case 11
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
            $iCStruct.ParameE = $ParmE
            $iCStruct.ParameF = $ParmF
            $iCStruct.ParameG = $ParmG
            $iCStruct.ParameH = $ParmH
            $iCStruct.ParameI = $ParmI
            $iCStruct.ParameJ = $ParmJ
            $iCStruct.ParameK = $ParmK
        Case 12
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
            $iCStruct.ParameE = $ParmE
            $iCStruct.ParameF = $ParmF
            $iCStruct.ParameG = $ParmG
            $iCStruct.ParameH = $ParmH
            $iCStruct.ParameI = $ParmI
            $iCStruct.ParameJ = $ParmJ
            $iCStruct.ParameK = $ParmK
            $iCStruct.ParameL = $ParmL
        Case 13
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
            $iCStruct.ParameE = $ParmE
            $iCStruct.ParameF = $ParmF
            $iCStruct.ParameG = $ParmG
            $iCStruct.ParameH = $ParmH
            $iCStruct.ParameI = $ParmI
            $iCStruct.ParameJ = $ParmJ
            $iCStruct.ParameK = $ParmK
            $iCStruct.ParameL = $ParmL
            $iCStruct.ParameM = $ParmM
        Case 14
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
            $iCStruct.ParameE = $ParmE
            $iCStruct.ParameF = $ParmF
            $iCStruct.ParameG = $ParmG
            $iCStruct.ParameH = $ParmH
            $iCStruct.ParameI = $ParmI
            $iCStruct.ParameJ = $ParmJ
            $iCStruct.ParameK = $ParmK
            $iCStruct.ParameL = $ParmL
            $iCStruct.ParameM = $ParmM
            $iCStruct.ParameN = $ParmN
        Case 15
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
            $iCStruct.ParameE = $ParmE
            $iCStruct.ParameF = $ParmF
            $iCStruct.ParameG = $ParmG
            $iCStruct.ParameH = $ParmH
            $iCStruct.ParameI = $ParmI
            $iCStruct.ParameJ = $ParmJ
            $iCStruct.ParameK = $ParmK
            $iCStruct.ParameL = $ParmL
            $iCStruct.ParameM = $ParmM
            $iCStruct.ParameN = $ParmN
            $iCStruct.ParameO = $ParmO
        Case 16
            $iCStruct.ParameA = $ParmA
            $iCStruct.ParameB = $ParmB
            $iCStruct.ParameC = $ParmC
            $iCStruct.ParameD = $ParmD
            $iCStruct.ParameE = $ParmE
            $iCStruct.ParameF = $ParmF
            $iCStruct.ParameG = $ParmG
            $iCStruct.ParameH = $ParmH
            $iCStruct.ParameI = $ParmI
            $iCStruct.ParameJ = $ParmJ
            $iCStruct.ParameK = $ParmK
            $iCStruct.ParameL = $ParmL
            $iCStruct.ParameM = $ParmM
            $iCStruct.ParameN = $ParmN
            $iCStruct.ParameO = $ParmO
            $iCStruct.ParameP = $ParmP
    EndSwitch
EndFunc

We need Assign to be able to set values for COM methods :hyper:.

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Dor access work correctly in AutoIt structure but that way you used similar to array but using  $tStruct(index) seems to work at least AutoIt syntaxis check allows it but it doesn't assign the value. 

I'll share my fast version in a while too. 

 

Saludos

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...