Load Bitmap from a specified path
-
Hai, HBITMAP bmp1; bmp1=SHLoadDIBitmap(_T("D:\\Code Guru\\a.bmp")); While I am debugging bmp1= not used, sometimes garbage value: how shall I find the width and height of the bmp1. BITMAP bminfo; bmp1.GetBitmap(&bminfo); When I use the above, It shows an error. left of '.GetBitmap' must have class/struct/union type Is there any other function instead of GetBitmap. pDC->StretchBlt(0,0,rc.Width(),rc.Height(), &dcMem, 0, 0, bminfo.bmWidth, bminfo.bmHeight, SRCCOPY); Note: compatible for WinCE DARWIN PAUL RAJ
-
Hai, HBITMAP bmp1; bmp1=SHLoadDIBitmap(_T("D:\\Code Guru\\a.bmp")); While I am debugging bmp1= not used, sometimes garbage value: how shall I find the width and height of the bmp1. BITMAP bminfo; bmp1.GetBitmap(&bminfo); When I use the above, It shows an error. left of '.GetBitmap' must have class/struct/union type Is there any other function instead of GetBitmap. pDC->StretchBlt(0,0,rc.Width(),rc.Height(), &dcMem, 0, 0, bminfo.bmWidth, bminfo.bmHeight, SRCCOPY); Note: compatible for WinCE DARWIN PAUL RAJ
S.DARWIN PAUL RAJ wrote: HBITMAP bmp1; bmp1=SHLoadDIBitmap(_T("D:\\Code Guru\\a.bmp")); While I am debugging bmp1= not used, sometimes garbage value: and S.DARWIN PAUL RAJ wrote: BITMAP bminfo; bmp1.GetBitmap(&bminfo); Buddy bmp1 is amember of HANDLE,and HANDLE is neither CLASS,STRUCT or UNION ----------------------------- "I Think It will Work" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk
-
Hai, HBITMAP bmp1; bmp1=SHLoadDIBitmap(_T("D:\\Code Guru\\a.bmp")); While I am debugging bmp1= not used, sometimes garbage value: how shall I find the width and height of the bmp1. BITMAP bminfo; bmp1.GetBitmap(&bminfo); When I use the above, It shows an error. left of '.GetBitmap' must have class/struct/union type Is there any other function instead of GetBitmap. pDC->StretchBlt(0,0,rc.Width(),rc.Height(), &dcMem, 0, 0, bminfo.bmWidth, bminfo.bmHeight, SRCCOPY); Note: compatible for WinCE DARWIN PAUL RAJ
Try:
HBITMAP hBitmap = SHLoadDIBitmap(_T("D:\\Code Guru\\a.bmp"));
if (NULL != hBitmap)
{
CBitmap *pBitmap = CBitmap::FromHandle(hBitmap);BITMAP bmInfo; if (pBitmap->GetBitmap(&bmInfo) != 0) { ... }
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
-
Try:
HBITMAP hBitmap = SHLoadDIBitmap(_T("D:\\Code Guru\\a.bmp"));
if (NULL != hBitmap)
{
CBitmap *pBitmap = CBitmap::FromHandle(hBitmap);BITMAP bmInfo; if (pBitmap->GetBitmap(&bmInfo) != 0) { ... }
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
Thank you, I got the result CBitmap bmp; HBITMAP bmp1; bmp1 =SHLoadDIBitmap(_T("D:\\codeproject\\a.bmp")); bmp.Attach(bmp1); BITMAP bminfo; bmp.GetBitmap(&bminfo); CDC dcMem; HBITMAP hbmpOld; dcMem.CreateCompatibleDC(pDC); hbmpOld =(HBITMAP)dcMem.SelectObject(&bmp); pDC->StretchBlt(0,0,rc.Width(),rc.Height(),&dcMem, 0,0, bminfo.bmWidth, bminfo.bmHeight, SRCCOPY); dcMem.SelectObject(hbmpOld); Still one more problem, When I stretched this bitmap into the entire screen, the controls(Button) which I placed above the bitmap not moved with bitmap, I want that todo, Give your hand on this issue regards DARWIN PAUL RAJ