Page 1 of 1
Reading Structure Argument
Posted: Tue Dec 21, 2010 10:27 pm
by LuaDev
Hi guys, here i go with another stupid question
im making a plugin for another development platform and the SDK requires that i export some functions, all is well for the most part, but.....
i have this function that passes a structure as a argument (not a pointer to the structure)
Code: Select all
EXPORT void _DrawDesign(long ClassID ,HDC hDC, HWND hMainWnd, RECT rcObRect, BOOL bVisible, BOOL bEnabled)
how on earth do i access the values of this structure ?, everything i try either fails or crashes the IDE
Re: Reading Structure Argument
Posted: Tue Dec 21, 2010 10:31 pm
by IceSoft
Wich SDK?
Re: Reading Structure Argument
Posted: Tue Dec 21, 2010 10:36 pm
by ts-soft
I think:
Code: Select all
Structure rcObRect
bla.i
;...
EndStructure
Define bla.rcObRect
_DrawDesign(ClassID, hDC, hMainWnd, @bla, #True, #True)
Debug bla\bla
Re: Reading Structure Argument
Posted: Tue Dec 21, 2010 11:03 pm
by LuaDev
Wich SDK?
the SDK is for AutoPlay Media Studio, but it requires you fill a C++ class (which cant be done in PB?) so a friend of mine wrote a wrapper (or proxy) dll that fills the class by calling functions from my dll
I think:
you misunderstand, that function must be defined in my dll and the proxy dll calls the function defined in my code and sends the RECT structure, i need to access the struct to get the dimensions of the host container to draw my object
i should have explained all this first to avoid confusion
Re: Reading Structure Argument
Posted: Tue Dec 21, 2010 11:52 pm
by LuaDev
nm, i got there in the end
Re: Reading Structure Argument
Posted: Wed Dec 22, 2010 10:53 am
by Trond
Are you sure you can access the last two parameters with your solution?
Re: Reading Structure Argument
Posted: Wed Dec 22, 2010 7:01 pm
by LuaDev
no i cant, didn't try till today and got all sorts of weird problems, back to the drawing board then i guess
Re: Reading Structure Argument
Posted: Wed Dec 22, 2010 7:44 pm
by Trond
Maybe this works:
Code: Select all
Procedure _DrawDesign(ClassID, hDC, hMainWnd, left, top, right, bottom, bVisible, Enabled)
Re: Reading Structure Argument
Posted: Wed Dec 22, 2010 8:20 pm
by LuaDev
yea, that seems to work ok, thanks
how did that happen, was the structure expanded somehow?
Re: Reading Structure Argument
Posted: Wed Dec 22, 2010 8:29 pm
by Demivec
LuaDev wrote:yea, that seems to work ok, thanks
how did that happen, was the structure expanded somehow?
The values of the structure are being pushed onto a parameter stack. The structure appears as a collection of (4) 4-byte integers. This would be the same as pushing 4 separate 4-byte integers. The sizes need to match properly for this to work.