Sign in to follow this  
Followers 0
Wooltown

DLLstruct

2 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
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
Sign in to follow this  
Followers 0