Locodarwin Posted March 3, 2008 Share Posted March 3, 2008 I'm automating the Canon SDK for the Canon PowerShot A640 series digital camera, and I've come up against a situation that I'd like to find a clean solution for. Is it possible to create a DLLStruct in AutoIt that is basically an array of another struct? The export function PR_GetDllsVersion() retrieves the version number of the DLL modules used in the SDK. Its syntax is: PR_GetDllsVersion( prUInt32* pBufferSize, prDllsVerInfo* pDllVersion ); In C, the structs associated with this function look like this: typedef struct{ prWChar ModuleName[512]; /* Module name (512 characters) */ prWChar Version[32]; /* Version (32 characters) */ }prVerInfo; typedef struct{ prUInt32 Entry; /* Number of modules included in this structure */ prVerInfo VerInfo[prANY]; /* Array of file version number information of PS-ReC SDK modules */ }prDllsVerInfo; So according to this, prDllsVerInfo contains an array of the prVerInfo data type, which in turn is a user defined struct. I presume I can just pass a simple char array that is the total size of prVerInfo and parse the data out myself later, but I'm looking for a cleaner way to do it that logically follows how it would be done in C. Any suggestions? Thanks in advance, -S (Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent] Link to comment Share on other sites More sharing options...
Locodarwin Posted March 4, 2008 Author Share Posted March 4, 2008 Bump. (Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent] Link to comment Share on other sites More sharing options...
Siao Posted March 4, 2008 Share Posted March 4, 2008 ;#1 ;creating $iCount = 5 $sVerInfo = "wchar[512];wchar[32];" $sDllsVerInfo = "uint;" For $i = 1 To $iCount $sDllsVerInfo &= $sVerInfo Next $sDllsVerInfo = StringTrimRight($sDllsVerInfo, 1) $tDllsVerInfo = DllStructCreate($sDllsVerInfo) DllStructSetData($tDllsVerInfo, 1, $iCount) ;reading back: For $i = 1 To DllStructSetData($tDllsVerInfo, 1) ConsoleWrite('Module name: ' & DllStructGetData($tDllsVerInfo, $i * 2) & @CRLF) ConsoleWrite('Version: ' & DllStructGetData($tDllsVerInfo, $i * 2 + 1) & @CRLF) Next ;#2 ;creating $iCount = 5 $iSizeVerInfo = (512+32)*2 $tDllsVerInfo = DllStructCreate('uint;byte[' & $iSizeVerInfo * $iCount & ']') DllStructSetData($tDllsVerInfo, 1, $iCount) ;reading back: For $i = 0 To DllStructSetData($tDllsVerInfo, 1) - 1 $tVerInfo = DllStructCreate("wchar[512];wchar[32]", DllStructGetPtr($tDllsVerInfo, 2) + $iSizeVerInfo * $i) ConsoleWrite('Module name: ' & DllStructGetData($tVerInfo, 1) & @CRLF) ConsoleWrite('Version: ' & DllStructGetData($tVerInfo, 2) & @CRLF) Next "be smart, drink your wine" 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