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

Managed C++/CLI

 
GeneralRe: Saving Bitmap image data to HGLOBAL Pin
alleyes21-Jan-10 9:20
professionalalleyes21-Jan-10 9:20 
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 
BITMAPINFOHEADER.biSizeImage is allowed to be 0...
I would personally feel better about checking for that unless
you know for sure it's never going to be 0...maybe something like
if (imgHeader->biSizeImage == 0)
    imgHeader->biSizeImage = (((imgHeader->biWidth * (long)imgHeader->biBitCount + 31L) & (~31L)) / 8L) * abs(imgHeader->biHeight);



Al_S wrote:
array<BYTE>^ imgArray = gcnew array<BYTE>(imgHeader->biSizeImage);



Your array isn't big enough. What about the size of the
BITMAPFILEHEADER and the BITMAPINFOHEADER?



Al_S wrote:
Marshal::Copy(static_cast<intptr>(Pixels), imgArray, (sizeof(BITMAPFILEHEADER) + 1), imgHeader->biSizeImage);


Array indexes are 0-based... That should be

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

Also I'm not sure about those static_casts... why not just use IntPtr(bfh)/IntPtr(Pixels)



Al_S wrote:
The file size is a lot larger than I would expect for a 640*480 32 bit BMP


Should be a little over 1MB - just how big is it? You're the one
calculating the size - what do you see in the debugger?

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: Creating image file from pointer to HGLOBAL Pin
alleyes12-Jan-10 10:25
professionalalleyes12-Jan-10 10:25 
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 

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.