2 messages in net.java.dev.jna.usersArray of Structure elements in contig...
FromSent OnAttachments
ZipliesJan 21, 2008 3:32 pm 
Timothy WallJan 21, 2008 3:52 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Array of Structure elements in contiguous memoryActions...
From:Ziplies (zipl@gmail.com)
Date:Jan 21, 2008 3:32:55 pm
List:net.java.dev.jna.users

Hello,

probably this may be the dumbest question asked on this mailing list, but I don't get it. I read through the API and the other mails on this list but I am not able to reproduce a functional code.

I have defined the SendInput method from User32 (as described in my other mail, again THX THX THX for the great answer). The method works very well, for ONE key.

Now, I want to push a Structure Array with two defined keys. This works from C# and the method is designed for that, but how the hell do I get an Array with two Inputs without a "contiguous memory" error. ^^#

I know that I can Array a Structure through .toArray, but that just gives me an Array of this one element. How do I put the second in this Array? I tried using .toArray(2) and setting the second one, but error. I defined a new Structure[2] Array, and set both, but error. I tried something like this:

INPUT[] inputs = new INPUT[2]; inputs[0] = new INPUT(); inputs[0].anon.setType(KEYBDINPUT.class); inputs[0].type = 1; inputs[0].anon.ki.wVk = Keyboard.ALT; inputs[0].anon.ki.dwFlags = 0x00;

inputs[1] = new INPUT(); inputs[1].anon.setType(KEYBDINPUT.class); inputs[1].type = 1; inputs[1].anon.ki.wVk = Keyboard.TAB; inputs[1].anon.ki.dwFlags = 0x00;

but error.

Again I am really stuck here and would be gracious for every help.

Regards