reissdorf Posted May 11, 2008 Posted May 11, 2008 Hello,I'm having serious problems understanding DllCall or rather what parameters I have to use.The C# code is:using System; using System.Runtime.InteropServices; namespace ApsDemo { class APS { [DllImport("sensor.dll")] public static extern void ShockproofGetAccelerometerData(ref AccData accData); [StructLayout(LayoutKind.Sequential)] public struct AccData { internal int status; internal short x; internal short y; } }All attempts I did ended in the normal windows error report I would really appreciate if someone could help me reading those variables!P.S: full code
martin Posted May 11, 2008 Posted May 11, 2008 My guess is that you need something like this $AccData = DllStructCreate("int;short;short") $res = DllCall("sensor.dll","none","ptr",DllStructGetPtr($AccData)) $status = DllStructGetData($AccData,1) $shortx = = DllStructGetData($AccData,2) $shorty = = DllStructGetData($AccData,3) [code=auto:0] but it's a guess because I don't know how the dll deals with a struct passed by reference. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
reissdorf Posted May 11, 2008 Author Posted May 11, 2008 Thanks so much for the help! I have been using the German help file, which just doesn't list the DllStructCreate function... an error I won't repeat
martin Posted May 11, 2008 Posted May 11, 2008 Thanks so much for the help!I have been using the German help file, which just doesn't list the DllStructCreate function... an error I won't repeat NP.I hadn't noticed that was your first post so welcome to the AutoIt forums! Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now