c# - COM pointer to struct -


I am using Visual Studio 2008 / .NET 3.5. I used VS to create COM component interoperable in .NET. I added a reference from the application to the COM DLL. COM DLL is a third party object - part of an SDK.

Everything is working well for all methods and events - COM objects / events are displayed as first class .NET objects / events.

Here's what's happening:

Scan () method runs. At the end of its execution it enhances an event. According to the document - Logic - lStructure -: ImageBuffer (int lStructure)

Description: The ImageBuffer event will notify the client application of the completion of a scan and pass a composition in which The width, height, size, and image buffer of the image were collected which were collected as part of the scan. The client application is responsible for freeing the memory allocated for image buffer and to freeze the memory for the structure. This event view may not be compatible with the original applications. Parameter:

int lStructure is a 32-bit pointer in the following structure

  struct _ImageBufferDef {int lWidth; // Image width in pixel int lHeight; // Size of the image height in pixels int lSize; // Image size bytes in unsigned small * pusBuffer; // Image with allocated memory}  

Here's where I got stuck: How do I recreate the object with only one int?


I have tried:

  [Layout layout (layout kick.sqyk)] String Image Buffer Def {Int'lWoodDude; Int lHeight; Int lSize; Interpet Pusfuffer; } Zero scanner_ezebuffer (intra laser architecture) {interrupt ptr = new interrupt (alstructure); ImageBufferDef buf = new ImageBufferDef (); Try {martial.procotory structure (ptr, buff); } Hold (exception e) {Console.WriteLine (e.Message); }}  

due to

  int lSize; // Image size bytes in unsigned small * pusBuffer; // After the allocated memory image  

after

  ImageBufferDef buffer def = (ImageBufferDef) martial.tterstrokes (PTR, typef (imagebuffer def));  

You can try

  short [] buffer = new short [buffer def.lis / 2]; Marshall.Copy (buffer DEF. POSSBUFFER, buffer, 0, buffer lang);  

If you change the buffer ARA type, then its length and Marshall.Copy be careful about the length < / Code> parameter, because the first thing to do is to get the size of the array element, which is 2 being a small [] , and the second element wants to count the total byte Count instead of array.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -