Re: Array from C++ DLL to Euphoria
- Posted by mattlewis (admin) Jul 11, 2013
- 1713 views
TheresNoTime said...
mattlewis said...
Could you tell us more about what you are trying to do? Based on what you've said, I think you'll want to probably not peek the whole thing, but just what you need when you need it, and poke values back as required. But that's just my speculation based on what you've said.
SAFEARRAY* DisplayBuffer = NULL; int __stdcall takeScreen() { if (DisplayBuffer) { SafeArrayDestroy(DisplayBuffer); DisplayBuffer=NULL; } HRESULT rc = VirtualDisplay->TakeScreenShotToArray(0, DisplayWidth, DisplayHeight, &DisplayBuffer); return SUCCEEDED(rc) ? EU_TRUE : EU_FALSE; }
I want to get screenshot and export it, pixel-by-pixel, to my program, written in Euphoria. May be, "takeScreen" must return pointer to DisplayBuffer?
P.S. Why TABs not converted to two spaces inside eucode tag? It is inconvenience.
Egad! A SafeArray. I recommend that you download EuCOM. It has stuff for handling them. In particular, they are in variant.ew. To wrap, you should be able to:
include variant.ew constant DisplayBuffer = define_c_var( the_dll, "DisplayBuffer" ) ? get_array( peek4u( DisplayBuffer ) )
Matt