Click here to Skip to main content
15,886,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CDialog in View Pin
KaЯl1-Mar-07 0:51
KaЯl1-Mar-07 0:51 
GeneralRe: CDialog in View Pin
baerten1-Mar-07 1:09
baerten1-Mar-07 1:09 
GeneralRe: CDialog in View Pin
KaЯl1-Mar-07 2:45
KaЯl1-Mar-07 2:45 
GeneralRe: CDialog in View [modified] Pin
baerten1-Mar-07 2:50
baerten1-Mar-07 2:50 
QuestionHow to modify the munu item status Pin
ilgale28-Feb-07 3:12
ilgale28-Feb-07 3:12 
QuestionRe: How to modify the munu item status Pin
prasad_som28-Feb-07 3:56
prasad_som28-Feb-07 3:56 
AnswerRe: How to modify the munu item status Pin
Ravi Bhavnani28-Feb-07 4:22
professionalRavi Bhavnani28-Feb-07 4:22 
QuestionHow to display the Bitmap that created by CreateBitmap function? Pin
vasu_sri28-Feb-07 1:43
vasu_sri28-Feb-07 1:43 
how can i display the bitmap on ListView using CreateBitmap function?

<br />
void CThumbBmpView::OnPaint()<br />
{<br />
	CPaintDC dc(this); // device context for painting<br />
	// TODO: Add your message handler code here<br />
	// Do not call CListView::OnPaint() for painting messages<br />
<br />
<br />
		CRect r;<br />
		GetClientRect(&r);<br />
<br />
		// Paint to a memory device context to help<br />
		// eliminate screen flicker.<br />
		CXTPBufferDC memDC(dc, r);<br />
		memDC.FillSolidRect(r, (RGB(255,255,255)));<br />
			<br />
		OnPrepareDC(&memDC);<br />
			OnDraw(&memDC);<br />
<br />
<br />
<br />
}<br />
<br />
<br />
<br />
void CThumbBmpView::OnDraw(CDC* pDC)<br />
{<br />
	// TODO: Add your specialized code here and/or call the base class<br />
	<br />
	HANDLE hFile;<br />
	DWORD  dwNumberOfBytesToRead;<br />
	DWORD  dwNumberOfBytesRead;<br />
	<br />
<br />
<br />
	hFile = CreateFile( "D:\\preview.bmp",<br />
						GENERIC_READ, <br />
						FILE_SHARE_READ,<br />
						NULL,<br />
						OPEN_EXISTING,<br />
						FILE_ATTRIBUTE_NORMAL,<br />
						NULL );<br />
<br />
	if( hFile == INVALID_HANDLE_VALUE )<br />
	{	<br />
		MessageBox( "Invalid Handle", "ERROR", MB_ICONERROR);<br />
<br />
	}<br />
	else<br />
	{<br />
		//	MessageBox( "File Opened successfully");<br />
		BYTE *Buffer;<br />
		DWORD p=SetFilePointer( hFile, 0x000, NULL, FILE_BEGIN );<br />
<br />
		Buffer = new BYTE [2363392+1];<br />
<br />
		BOOL bResult = ReadFile( hFile,<br />
								 Buffer,<br />
								// nNumberOfBytesToRead, //specify the file size.<br />
								 2363392,<br />
								 &dwNumberOfBytesRead,  //<br />
								 NULL<br />
								);<br />
<br />
		if(!bResult)<br />
			MessageBox("Error");<br />
<br />
<br />
<br />
<br />
		//bmp.bmType		=0;<br />
		//bmp.bmWidth		=32;<br />
		//bmp.bmHeight	=32;<br />
		//bmp.bmWidthBytes=1024;<br />
		//bmp.bmPlanes	=2;<br />
		//bmp.bmBitsPixel	=32;<br />
		//bmp.bmBits		=Buffer;<br />
<br />
		if(!bitmap.CreateBitmap(1000,500,1,32,Buffer))<br />
			MessageBox("cant Create Bitmap");<br />
	<br />
	}<br />
	CDC dcCompatible;<br />
	if ( !dcCompatible.CreateCompatibleDC( pDC ) )<br />
	{<br />
		return;<br />
	}<br />
	CBitmap* pOld = dcCompatible.SelectObject( &bitmap );<br />
<br />
	BITMAP bmInfo;<br />
	if ( bitmap.GetObject( sizeof( bmInfo ), &bmInfo ) != 0 )<br />
	{<br />
		pDC->BitBlt( 0,0, bmInfo.bmWidth, bmInfo.bmHeight, &dcCompatible, 0,0, SRCCOPY );<br />
		//pDC->StretchBlt(0,0,100,90,&dcCompatible,10,10,110,100, 32); <br />
<br />
	}<br />
<br />
	dcCompatible.SelectObject( pOld );<br />
<br />
}<br />
<br />
<br />



Regards,
Srinivas

AnswerRe: How to display the Bitmap that created by CreateBitmap function? Pin
Naveen28-Feb-07 2:01
Naveen28-Feb-07 2:01 
GeneralRe: How to display the Bitmap that created by CreateBitmap function? Pin
CPallini28-Feb-07 2:06
mveCPallini28-Feb-07 2:06 
GeneralRe: How to display the Bitmap that created by CreateBitmap function? Pin
Naveen28-Feb-07 2:14
Naveen28-Feb-07 2:14 
GeneralAnd why? Pin
CPallini28-Feb-07 2:40
mveCPallini28-Feb-07 2:40 
GeneralRe: And why? Pin
Naveen28-Feb-07 16:48
Naveen28-Feb-07 16:48 
GeneralRe: And why? Pin
CPallini1-Mar-07 0:06
mveCPallini1-Mar-07 0:06 
AnswerRe: How to display the Bitmap that created by CreateBitmap function? Pin
Naveen28-Feb-07 2:05
Naveen28-Feb-07 2:05 
General[Modified] Re: How to display the Bitmap that created by CreateBitmap function? Pin
CPallini28-Feb-07 2:11
mveCPallini28-Feb-07 2:11 
GeneralRe: How to display the Bitmap that created by CreateBitmap function? Pin
Naveen28-Feb-07 2:13
Naveen28-Feb-07 2:13 
GeneralRe: How to display the Bitmap that created by CreateBitmap function? Pin
vasu_sri28-Feb-07 2:26
vasu_sri28-Feb-07 2:26 
GeneralRe: How to display the Bitmap that created by CreateBitmap function? Pin
Naveen28-Feb-07 17:01
Naveen28-Feb-07 17:01 
GeneralRe: How to display the Bitmap that created by CreateBitmap function? Pin
vasu_sri28-Feb-07 20:17
vasu_sri28-Feb-07 20:17 
GeneralRe: How to display the Bitmap that created by CreateBitmap function? Pin
Naveen28-Feb-07 20:59
Naveen28-Feb-07 20:59 
Questionseprator in toolbar Pin
sulabh_expert@rediffmail.com28-Feb-07 1:25
sulabh_expert@rediffmail.com28-Feb-07 1:25 
AnswerRe: seprator in toolbar Pin
Nibu babu thomas28-Feb-07 1:29
Nibu babu thomas28-Feb-07 1:29 
Questionchanging text of listCtrl-header - part two Pin
ensger28-Feb-07 1:21
ensger28-Feb-07 1:21 
AnswerRe: changing text of listCtrl-header - part two Pin
prasad_som28-Feb-07 1:35
prasad_som28-Feb-07 1:35 

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.