Jump to content

A problem about DllStruct

Recommended Posts

@TheXman 's answer solves the problem perfectly ( @NewCommer : you should mark it as solution ;)).

Instead of ENUM you could also use ($n+0), but this is probably not the most elegant work-around.

Local $n = 1
Local $t = DllStructCreate('int Test[2]')
ConsoleWrite("@error = " & @error & @CRLF)
$t.Test(1) = 123
$t.Test(2) = 345
MsgBox(0, 0, _
        $t.Test(1) & @CRLF & _
        $t.Test($n+0) & @CRLF & _
        $t.Test($n+1) & @CRLF & _
        $t.Test(Number($n)) & @CRLF & _



"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

I just tried  to answer the question as to why it wasn't working as expected.  I made no suggestions as to how to resolve the problem.

For the record, in this case, I would only use an enum if naming the indexes made sense (making the code more readable and/or easier to maintain).  😉

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

  • Recently Browsing   0 members

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