monoceres Posted April 30, 2008 Share Posted April 30, 2008 Hello! I'm having some problems translating a struct declared in delphi to autoit: AVI_STREAM_INFO = packed record fccType : DWORD; fccHandler : DWORD; dwFlags : DWORD; dwCaps : DWORD; wPriority : word; wLanguage : word; dwScale : DWORD; dwRate : DWORD; dwStart : DWORD; dwLength : DWORD; dwInitialFrames : DWORD; dwSuggestedBufferSize : DWORD; dwQuality : DWORD; dwSampleSize : DWORD; rcFrame : TRect; dwEditCount : DWORD; dwFormatChangeCount : DWORD; szName : array [0..63] of char; end; As you can see it's not very advanced and mostly it's just a whole bunch of dwords But then I come to rcFrame which is supposed to be a TRect. TRect seems to be a the delphi equivalence of a regular rect struct (int x1, int y1, int x2, int y2) But even if I create a rect struct, how would I use it in my other struct? Anyways any ideas? Thanks! Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
weaponx Posted April 30, 2008 Share Posted April 30, 2008 Will this work? $trect = DllStructCreate("int x1; int y1; int x2; int y2") if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif $str = "DWORD fccType;" $str&= "DWORD fccHandler;" $str&= "DWORD dwFlags;" $str&= "DWORD dwCaps;" $str&= "word wPriority;" $str&= "word wLanguage;" $str&= "DWORD dwScale;" $str&= "DWORD dwRate;" $str&= "DWORD dwStart;" $str&= "DWORD dwLength;" $str&= "DWORD dwInitialFrames;" $str&= "DWORD dwSuggestedBufferSize;" $str&= "DWORD dwQuality;" $str&= "DWORD dwSampleSize;" $str&= $trect & " rcFrame;" $str&= "DWORD dwEditCount;" $str&= "DWORD dwFormatChangeCount;" $str&= "var[64] szName;" $struct2 = DllStructCreate($str) if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif Link to comment Share on other sites More sharing options...
monoceres Posted April 30, 2008 Author Share Posted April 30, 2008 Will this work? $trect = DllStructCreate("int x1; int y1; int x2; int y2") if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif $str = "DWORD fccType;" $str&= "DWORD fccHandler;" $str&= "DWORD dwFlags;" $str&= "DWORD dwCaps;" $str&= "word wPriority;" $str&= "word wLanguage;" $str&= "DWORD dwScale;" $str&= "DWORD dwRate;" $str&= "DWORD dwStart;" $str&= "DWORD dwLength;" $str&= "DWORD dwInitialFrames;" $str&= "DWORD dwSuggestedBufferSize;" $str&= "DWORD dwQuality;" $str&= "DWORD dwSampleSize;" $str&= $trect & " rcFrame;" $str&= "DWORD dwEditCount;" $str&= "DWORD dwFormatChangeCount;" $str&= "var[64] szName;" $struct2 = DllStructCreate($str) if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endifNope @error = 2 Element value out of range. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
weaponx Posted April 30, 2008 Share Posted April 30, 2008 (edited) I'm not very proficient with this dll stuff...I also can't find much about nested structs. I'm not even sure AutoIt can handle this type of thing due to the lack of OOP. $trect = DllStructCreate("int x1; int y1; int x2; int y2") if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif $str = "DWORD fccType;" $str&= "DWORD fccHandler;" $str&= "DWORD dwFlags;" $str&= "DWORD dwCaps;" $str&= "word wPriority;" $str&= "word wLanguage;" $str&= "DWORD dwScale;" $str&= "DWORD dwRate;" $str&= "DWORD dwStart;" $str&= "DWORD dwLength;" $str&= "DWORD dwInitialFrames;" $str&= "DWORD dwSuggestedBufferSize;" $str&= "DWORD dwQuality;" $str&= "DWORD dwSampleSize;" $str&= "ptr " & DllStructGetPtr($trect) & ";" $str&= "DWORD dwEditCount;" $str&= "DWORD dwFormatChangeCount;" $str&= "var[64] szName;" $struct2 = DllStructCreate($str) if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif Edited April 30, 2008 by weaponx Link to comment Share on other sites More sharing options...
monoceres Posted April 30, 2008 Author Share Posted April 30, 2008 I'm not very proficient with this dll stuff...I also can't find mutch about nested structs. $trect = DllStructCreate("int x1; int y1; int x2; int y2") if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif $str = "DWORD fccType;" $str&= "DWORD fccHandler;" $str&= "DWORD dwFlags;" $str&= "DWORD dwCaps;" $str&= "word wPriority;" $str&= "word wLanguage;" $str&= "DWORD dwScale;" $str&= "DWORD dwRate;" $str&= "DWORD dwStart;" $str&= "DWORD dwLength;" $str&= "DWORD dwInitialFrames;" $str&= "DWORD dwSuggestedBufferSize;" $str&= "DWORD dwQuality;" $str&= "DWORD dwSampleSize;" $str&= "ptr " & DllStructGetPtr($trect) & ";" $str&= "DWORD dwEditCount;" $str&= "DWORD dwFormatChangeCount;" $str&= "var[64] szName;" $struct2 = DllStructCreate($str) if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endifStill @error=2 Hope Siao will pop in and clear up the situation, he's really good at this Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Siao Posted April 30, 2008 Share Posted April 30, 2008 (edited) Rect as part of another structure is just the same as Rect alone. 4 ints in a row. If you want, you can group them into int Rect[4] If you still need examples, take a look at files in Include folder. It has to be used there quite a lot. Edited April 30, 2008 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
monoceres Posted April 30, 2008 Author Share Posted April 30, 2008 Rect as part of another structure is just the same as Rect alone. 4 ints in a row. If you want, you can group them into int Rect[4] If you still need examples, take a look at files in Include folder. It has to be used there quite a lot.Thanks Siao for clearing up the situation Broken link? PM me and I'll send you the file! 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