AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Passing an array as a dllcall parameter

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Kellianjaxon



Joined: 04 Jan 2008
Posts: 102

PostPosted: Fri Dec 18, 2009 11:55 am    Post subject: Passing an array as a dllcall parameter Reply with quote

Is it possible? How?

WaitForMultipleObjects @ http://msdn.microsoft.com/en-us/library/ms687025%28VS.85%29.aspx
Back to top
View user's profile Send private message
UncleScrooge



Joined: 14 Apr 2009
Posts: 75
Location: Italy

PostPosted: Fri Dec 18, 2009 4:16 pm    Post subject: Reply with quote

try this (by heresy)
you'll find there links to Lexikos utility to translate API structures into AHK as well as the DllCall() snippet-er by heresy himself and the windows constant bible by SKAN... enjoy
_________________
Intel Centrino @ 2.8GHz
4 GB RAM
WIN XP SP3
Back to top
View user's profile Send private message AIM Address
jethrow



Joined: 24 May 2009
Posts: 1907
Location: Iowa, USA

PostPosted: Fri Dec 18, 2009 4:21 pm    Post subject: Reply with quote

I just recently learned this, so here you go:
A Byte is 8 bits; a handle (lpHandles) is a 32-bit integer - which is 4 Bytes; if you want an array with 3 handles, you first need to set the capacity:
Code:
VarSetCapacity( lpHandles, 3 * 4 ) ; set variable capacity to 12 Bytes
For this example, keep in mind that array indices start at 0. Now you have a variable that is 12 Bytes; since each handle is 4 bytes, you will put the handles in this variable at the locations 0,4,8 :
Code:
NumPut( handle0, lpHandles, 0 * 4 ) ; handle0 contains the first handle
NumPut( handle1, lpHandles, 1 * 4 ) ; handle1 contains the second handle
NumPut( handle2, lpHandles, 2 * 4 ) ; handle2 contains the third handle
Now, you should be able to pass the second parameter of the DllCall as:
Code:
 , "Uint", &lpHandles
There is an example of the DllCall in this thread. I have not tested this, so if anyone notices I've given wrong information, please correct me Smile . Hope that helps.
_________________
Very Happy - in case I forgot to smile
Basic Webpage Controls
COM Object Reference
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Kellianjaxon



Joined: 04 Jan 2008
Posts: 102

PostPosted: Fri Dec 18, 2009 9:40 pm    Post subject: Reply with quote

So all simulating an array takes is simply putting elements' data to adjacent memory addresses and then using the "starting address" as a pointer? Nice!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group