H
Hilton
Hi,
I have an MFC DLL that reads a file and generates a bitmap which I then need
to display in my C# app. This is a CF 1.0 app (so no Graphics.GetDC method
unless I use GraphicsEx). I have two plans:
Plan A:
The C# app passes in the file name and some other parameters to the DLL.
Then the app gets the image's width and height from the DLL and (in the C#
world) does a new Bitmap (w, h). The app then passes this bitmap back to
the DLL and the DLL draws into it. This way, the Bitmap's memory management
is done in C# and the DLL is only used to draw into the bitmap, not to
create/dispose the bitmap.
Plan B:
The C# all passes in the filename and some other parameters to the DLL and
gets back a bitmap. The DLL would create/dispose the bitmap.
Please let me know what you think of these two approaches (or if there is a
third). Also, if you can help with the PInvoke stuff that would be
appreciated. I read that I can pass a C# Graphics object in as a CDC
pointer, but that doesn't seem to work. Also, what would be the cherry on
top is if I could force the image to an indexed image to save memory.
Any ideas, comments, URLs, example code very very very much appreciated.
Thanks,
Hilton
I have an MFC DLL that reads a file and generates a bitmap which I then need
to display in my C# app. This is a CF 1.0 app (so no Graphics.GetDC method
unless I use GraphicsEx). I have two plans:
Plan A:
The C# app passes in the file name and some other parameters to the DLL.
Then the app gets the image's width and height from the DLL and (in the C#
world) does a new Bitmap (w, h). The app then passes this bitmap back to
the DLL and the DLL draws into it. This way, the Bitmap's memory management
is done in C# and the DLL is only used to draw into the bitmap, not to
create/dispose the bitmap.
Plan B:
The C# all passes in the filename and some other parameters to the DLL and
gets back a bitmap. The DLL would create/dispose the bitmap.
Please let me know what you think of these two approaches (or if there is a
third). Also, if you can help with the PInvoke stuff that would be
appreciated. I read that I can pass a C# Graphics object in as a CDC
pointer, but that doesn't seem to work. Also, what would be the cherry on
top is if I could force the image to an indexed image to save memory.
Any ideas, comments, URLs, example code very very very much appreciated.
Thanks,
Hilton