Jump to content

Recommended Posts

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")

Func UserRead($_UserInfo)
$name     = DllStructGetData($_UserInfo,1)


But in a Function How does the function now that $UserInfo is a Struct ?


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)

Func Function1(ByRef $DllStr)
    Local $Temp = DllStructGetData($DllStr, 1)
    If @error <> 0 Then
        Return -1; Not a DllStruct
        Return 1
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...