Click here to Skip to main content
15,902,112 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Saving Bitmap image data to HGLOBAL Pin
alleyes20-Jan-10 7:34
professionalalleyes20-Jan-10 7:34 
GeneralRe: Saving Bitmap image data to HGLOBAL Pin
Mark Salsbery20-Jan-10 7:40
Mark Salsbery20-Jan-10 7:40 
GeneralRe: Saving Bitmap image data to HGLOBAL Pin
alleyes20-Jan-10 7:51
professionalalleyes20-Jan-10 7:51 
QuestionFade TabPage between TabControl's tab selection Pin
roshihans15-Jan-10 19:02
roshihans15-Jan-10 19:02 
QuestionI need an ebay program Pin
totolcm13-Jan-10 2:22
totolcm13-Jan-10 2:22 
QuestionCreating image file from pointer to HGLOBAL Pin
alleyes10-Jan-10 12:28
professionalalleyes10-Jan-10 12:28 
AnswerRe: Creating image file from pointer to HGLOBAL Pin
Mark Salsbery12-Jan-10 9:59
Mark Salsbery12-Jan-10 9:59 
GeneralRe: Creating image file from pointer to HGLOBAL Pin
alleyes12-Jan-10 10:25
professionalalleyes12-Jan-10 10:25 
Hi Mark.

Since the original image is from a global pointer to HGLOBAL, which was previously created and displayed, I am aware of all the fields of the BITMAPINFOHEADER. They are all set from grabbing an image in other code. I am trying to re-create the image after handing off the pointer to HGLOBAL elsewhere

With that:

biSizeImage = 0x12c000 (about 1.2M)
biBitCount = 0x20
...
...

I saw that the array size was goofy so I fixed that - I think.

array<byte>^ imgArray = gcnew array<byte>(imgHeader->biSizeImage + sizeof(BITMAPFILEHEADER));

I also fixed copying to the array:

Marshal::Copy(static_cast<IntPtr>(bfh), imgArray, 0, sizeof(BITMAPFILEHEADER));
Marshal::Copy(static_cast<IntPtr>(Pixels), imgArray, sizeof(BITMAPFILEHEADER), imgHeader->biSizeImage);



All this washes out to a correct file size.

When viewed in a hex editor, the BITMAPFILEHEADER appears where it belongs correctly. The rest of the data is different though. The resultant image can not be viewed Dead | X|

As far as the use of the static_cast, I don't have any problems with that and I think I've used it properly.

Thanks for responding.
GeneralRe: Creating image file from pointer to HGLOBAL [modified] Pin
Mark Salsbery12-Jan-10 10:34
Mark Salsbery12-Jan-10 10:34 
GeneralRe: Creating image file from pointer to HGLOBAL Pin
alleyes12-Jan-10 10:52
professionalalleyes12-Jan-10 10:52 
GeneralRe: Creating image file from pointer to HGLOBAL Pin
alleyes20-Jan-10 3:02
professionalalleyes20-Jan-10 3:02 
GeneralRe: Creating image file from pointer to HGLOBAL Pin
Mouzam Basheer23-May-16 20:40
Mouzam Basheer23-May-16 20:40 
QuestionGetting screen width and height Pin
m_mun7-Jan-10 4:12
m_mun7-Jan-10 4:12 
AnswerRe: Getting screen width and height Pin
Luc Pattyn7-Jan-10 4:19
sitebuilderLuc Pattyn7-Jan-10 4:19 
AnswerRe: Getting screen width and height Pin
Andreoli Carlo17-Jan-10 22:41
professionalAndreoli Carlo17-Jan-10 22:41 
QuestionSystem::String ^ to LPCWSTR conversion? Pin
Mattzimmerer6-Jan-10 22:27
Mattzimmerer6-Jan-10 22:27 
AnswerRe: System::String ^ to LPCWSTR conversion? Pin
Richard MacCutchan7-Jan-10 0:25
mveRichard MacCutchan7-Jan-10 0:25 
GeneralRe: System::String ^ to LPCWSTR conversion? Pin
Mattzimmerer7-Jan-10 9:14
Mattzimmerer7-Jan-10 9:14 
GeneralRe: System::String ^ to LPCWSTR conversion? Pin
Richard MacCutchan7-Jan-10 9:54
mveRichard MacCutchan7-Jan-10 9:54 
AnswerRe: System::String ^ to LPCWSTR conversion? [modified] Pin
Mark Salsbery7-Jan-10 9:35
Mark Salsbery7-Jan-10 9:35 
QuestionRe: System::String ^ to LPCWSTR conversion? Pin
Mattzimmerer7-Jan-10 9:59
Mattzimmerer7-Jan-10 9:59 
AnswerRe: System::String ^ to LPCWSTR conversion? Pin
Mark Salsbery7-Jan-10 12:56
Mark Salsbery7-Jan-10 12:56 
GeneralRe: System::String ^ to LPCWSTR conversion? Pin
Mattzimmerer7-Jan-10 22:01
Mattzimmerer7-Jan-10 22:01 
QuestionHow to Get DataTable column name ?? [modified] Pin
ajaxswan6-Jan-10 18:18
ajaxswan6-Jan-10 18:18 
AnswerRe: How to Get DataTable column name ?? Pin
Andreoli Carlo19-Jan-10 2:30
professionalAndreoli Carlo19-Jan-10 2:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.