Click here to Skip to main content
16,007,126 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Get string without CSDIFormView ... Pin
Masaaki Onishi18-Apr-01 15:58
Masaaki Onishi18-Apr-01 15:58 
GeneralRe: Get string without CSDIFormView ... Pin
Hadi Rezaee19-Apr-01 0:12
Hadi Rezaee19-Apr-01 0:12 
QuestionHow to send a 'refresh' message to MS-Dev from an another MFC application Pin
EiSl18-Apr-01 3:14
EiSl18-Apr-01 3:14 
GeneralCListCtrl Sorting Pin
Mustafa Demirhan18-Apr-01 3:07
Mustafa Demirhan18-Apr-01 3:07 
GeneralRe: CListCtrl Sorting Pin
18-Apr-01 19:14
suss18-Apr-01 19:14 
GeneralRe: CListCtrl Sorting Pin
Ammar18-Apr-01 19:33
Ammar18-Apr-01 19:33 
GeneralRe: CListCtrl Sorting Pin
19-Apr-01 5:11
suss19-Apr-01 5:11 
GeneralrtWhy the bitmap just don't show?! Pin
hike18-Apr-01 1:25
hike18-Apr-01 1:25 
I try to create and show a bitmap based on one short array.No error occours during compile,but the bitmap just don't show on the view.
My code as follow:
void CReadfile1View::DrawDIBSection(HDC hDC , int xDest,int yDest,int w, int h,signed short*image)
{

BITMAPINFOHEADER *bih=0;
// HDC hDC=0;
HBITMAP hbm;
void *bits;
try
{ // allocate room for BITMAPINFOHEADER and color mask's
if(!(bih = (BITMAPINFOHEADER*)malloc(sizeof(BITMAPINFOHEADER))))
throw 0;
ZeroMemory(bih,sizeof(BITMAPINFOHEADER));
bih->biSize = sizeof(BITMAPINFOHEADER);
bih->biWidth = w; // .
bih->biHeight = h; // match array-size
bih->biPlanes = 1;
bih->biBitCount = 16;
bih->biCompression = BI_RGB; // we use 5:5:5 format
bih->biSizeImage = bih->biWidth * 2 * bih->biHeight;
if(!(hDC = ::GetDC(0))) throw 0; // create the 16-bit DIBSECTION
if(!(hbm = ::CreateDIBSection(hDC,(BITMAPINFO*)bih,DIB_RGB_COLORS,&bits,0,0))) //
throw 0; // get the array into the DIBSECTION
if(::SetDIBits(hDC,hbm,0,h,image,(BITMAPINFO*)bih, DIB_RGB_COLORS) != h)
throw 0;
}
catch(...)
{
// cout<<"unknown type of exception throw"<<'\n';
}

HDC hDCMem=::CreateCompatibleDC(hDC);
HGDIOBJ hBmpOld=::SelectObject(hDCMem,hbm);
BitBlt(hDC,xDest,yDest,bih->biWidth,bih->biHeight,hDCMem,0,0,SRCCOPY);

::SelectObject(hDCMem, hBmpOld);
::DeleteDC(hDCMem);
if(hDC) ::ReleaseDC(0,hDC);
if(bih) free(bih);
}
void CReadfile1View::OnDraw(CDC* pDC)
{
CReadfile1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
DrawDIBSection(*pDC,10,10,WIDTH,HEIGHT,pDoc->Image[0]);
}
Who can tell me why it don't works and how to improve?!
thanx!
Eek! | :eek: Eek! | :eek:

fly against the wind
GeneralRe: rtWhy the bitmap just don't show?! Pin
Istvan Eperjesy23-Apr-01 1:16
Istvan Eperjesy23-Apr-01 1:16 
GeneralProblem, help !! Pin
VitSoft18-Apr-01 0:50
VitSoft18-Apr-01 0:50 
GeneralRe: Problem, help !! Pin
NormDroid18-Apr-01 0:58
professionalNormDroid18-Apr-01 0:58 
GeneralRe: Problem, help !! Pin
VitSoft18-Apr-01 1:12
VitSoft18-Apr-01 1:12 
GeneralRe: Problem, help !! Pin
Michael Dunn18-Apr-01 8:05
sitebuilderMichael Dunn18-Apr-01 8:05 
GeneralChanging security attributes in Access Pin
Ammar17-Apr-01 23:08
Ammar17-Apr-01 23:08 
GeneralDay Light Savings Time ( is it on) Pin
Colin J Davies17-Apr-01 19:47
Colin J Davies17-Apr-01 19:47 
GeneralRe: Day Light Savings Time ( is it on) Pin
Michael Dunn17-Apr-01 20:03
sitebuilderMichael Dunn17-Apr-01 20:03 
GeneralRe: Day Light Savings Time ( is it on) Pin
Colin J Davies17-Apr-01 21:00
Colin J Davies17-Apr-01 21:00 
GeneralFast Algorithm needed for Co-odinates along Ellipse Pin
Wolfram Steinke17-Apr-01 19:39
Wolfram Steinke17-Apr-01 19:39 
GeneralRe: Fast Algorithm needed for Co-odinates along Ellipse Pin
Christian Graus17-Apr-01 21:56
protectorChristian Graus17-Apr-01 21:56 
Generallinker eror Pin
17-Apr-01 18:42
suss17-Apr-01 18:42 
GeneralIMPLIB equivalent for VC++ Pin
Yong Haur TAY17-Apr-01 18:04
Yong Haur TAY17-Apr-01 18:04 
GeneralVB Add-In Programming Pin
Jamie Nordmeyer17-Apr-01 12:57
Jamie Nordmeyer17-Apr-01 12:57 
GeneralVB Add-In Programming Pin
Jamie Nordmeyer17-Apr-01 12:56
Jamie Nordmeyer17-Apr-01 12:56 
GeneralWin32 executable location Pin
Michael Anderson17-Apr-01 11:08
Michael Anderson17-Apr-01 11:08 
GeneralRe: Win32 executable location Pin
Chris Losinger17-Apr-01 11:13
professionalChris Losinger17-Apr-01 11:13 

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.