Wooltown Posted February 3, 2006 Posted February 3, 2006 Hello ! Can anyone guide me how to use DllStruct. In the main part of the Script I can set a Struct $UserInfo = DllStructCreate ("char;char;char;int;byte;byte") DllStructSetData($UserInfo,1,"aa") UserRead($UserInfo) Func UserRead($_UserInfo) $name = DllStructGetData($_UserInfo,1) . . . EndFunc But in a Function How does the function now that $UserInfo is a Struct ? /Sven
Jotun Posted February 3, 2006 Posted February 3, 2006 You could just check the @error macro after you call DllStructGetData Dim $NormalVar = 50 Dim $Struct = DllStructCreate("int;int;int") DllStructSetData($Struct, 1, 10) DllStructSetData($Struct, 2, 20) DllStructSetData($Struct, 3, 30) $Check = Function1($Struct) MsgBox(0, "", $Check) $Check = Function1($NormalVar) MsgBox(0, "", $Check) Exit Func Function1(ByRef $DllStr) Local $Temp = DllStructGetData($DllStr, 1) If @error <> 0 Then Return -1; Not a DllStruct Else Return 1 EndIf EndFunc
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now