ernesthan Posted August 28, 2010 Share Posted August 28, 2010 how about support for unions so that we could easly make structs like this: typedef union _TYPEX_HEADER { TYPE0_HEADER Type0Hdr; TYPE1_HEADER Type1Hdr; TYPE2_HEADER Type2Hdr; ULONG vulConfig[64]; }TYPEX_HEADER, *PTYPEX_HEADER; Link to comment Share on other sites More sharing options...
trancexx Posted August 28, 2010 Share Posted August 28, 2010 (edited) It's all the same. A line of code more or less. Edited August 28, 2010 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 28, 2010 Share Posted August 28, 2010 AutoIt doesn't have direct support for unions. They can be forged out of several dll structs or manual reading of data (like just make a byte array large enough to hold everything and read the bytes into your own format. Link to comment Share on other sites More sharing options...
ernesthan Posted August 30, 2010 Author Share Posted August 30, 2010 how ? Link to comment Share on other sites More sharing options...
trancexx Posted August 30, 2010 Share Posted August 30, 2010 You make e.g. raw structure in required size:$tUNION_Raw = DllStructCreate("byte[4]")Then depending on your needs interpret data the way you like it:$tUNION_Dword = DllStructCreate("dword", DllStructGetPtr($tUNION_Raw)) $iDWORD = DllStructGetData($tUNION_Dword, 1)$tUNION_Int = DllStructCreate("int", DllStructGetPtr($tUNION_Raw)) $iINT = DllStructGetData($tUNION_Int, 1)$tUNION_Float = DllStructCreate("float", DllStructGetPtr($tUNION_Raw)) $nFLOAT = DllStructGetData($tUNION_Float, 1) ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
AndyG Posted August 30, 2010 Share Posted August 30, 2010 (edited) An other example...or$unionstruct=dllstructcreate("char [16];float",dllstructgetptr($Something_in_Memory_struct)) $string=dllstructgetdata($unionstruct,1) $float=dllstructgetdata($unionstruct,2) msgbox(0,$String,$float) Edited August 30, 2010 by AndyG Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 30, 2010 Share Posted August 30, 2010 That was a very good example, trancexx. Link to comment Share on other sites More sharing options...
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