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

C / C++ / MFC

 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery3-Oct-07 12:49
Mark Salsbery3-Oct-07 12:49 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish8-Oct-07 15:17
Kiran Satish8-Oct-07 15:17 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery9-Oct-07 6:00
Mark Salsbery9-Oct-07 6:00 
GeneralRe: Need a best possible alternative?? [modified] Pin
Kiran Satish9-Oct-07 6:10
Kiran Satish9-Oct-07 6:10 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery9-Oct-07 8:01
Mark Salsbery9-Oct-07 8:01 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish9-Oct-07 10:49
Kiran Satish9-Oct-07 10:49 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery10-Oct-07 5:24
Mark Salsbery10-Oct-07 5:24 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish10-Oct-07 6:56
Kiran Satish10-Oct-07 6:56 
Thanks for the reply, it seems the steps are shown in the example of CDC::CreateCompatibleDC in MSDN. But there they are using direct bitmaps (CBitmap class).

Here is how I modified my code based upon your suggesitons above and the exmpale in MSDN

SVDisp->GetClientRect(&rect);<br />
align_top = (unsigned long) (rect.bottom - rect.top - row) / 2;<br />
align_left = (unsigned long) (rect.right - rect.left - col) / 2;<br />
<br />
RGBTRIPLE *pCurRowPixel = (RGBTRIPLE *)(pDIBSectionBits);<br />
for (int y = 0; y < col; ++y)<br />
{<br />
	for (int x = 0; x < row; ++x)<br />
	{<br />
		color = (BYTE) data[x * col + (row - 1 - y)];<br />
		pCurRowPixel[x].rgbtBlue = color;<br />
		pCurRowPixel[x].rgbtGreen = color;<br />
		pCurRowPixel[x].rgbtRed = color;<br />
	}<br />
	pCurRowPixel = (RGBTRIPLE *)((BYTE*)pCurRowPixel + Stride);<br />
}<br />
	<br />
CDC *SVCDC = SVDisp->GetDC();<br />
CDC DIBSectionDC;<br />
DIBSectionDC.CreateCompatibleDC(SVCDC);<br />
HGDIOBJ hbmOldDIBSecBM = ::SelectObject(DIBSectionDC, hbm);<br />
SVCDC->BitBlt(align_left, align_top, bmi.bmiHeader.biWidth, bmi.bmiHeader.biHeight, &DIBSectionDC, 0, 0, SRCCOPY);<br />
<br />
DIBSectionDC.SelectObject(hbmOldDIBSecBM);<br />
SVDisp->ReleaseDC(SVCDC);


it doesnt give any errors, but it shows up nothin on the window, I have seen different values being stored into pDIBSectionBits between (0-255).

The dialog box is filled with a textbox and I am using its handle for getting DC and all. The SVDisp in the above code is a window pointer to that text box.

PKNT

modified on Thursday, September 17, 2009 1:47 PM

GeneralRe: Need a best possible alternative?? Pin
Kiran Satish11-Oct-07 5:14
Kiran Satish11-Oct-07 5:14 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery11-Oct-07 5:30
Mark Salsbery11-Oct-07 5:30 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish11-Oct-07 12:53
Kiran Satish11-Oct-07 12:53 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery11-Oct-07 13:06
Mark Salsbery11-Oct-07 13:06 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish11-Oct-07 13:31
Kiran Satish11-Oct-07 13:31 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery11-Oct-07 13:41
Mark Salsbery11-Oct-07 13:41 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish11-Oct-07 13:46
Kiran Satish11-Oct-07 13:46 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish17-Oct-07 11:09
Kiran Satish17-Oct-07 11:09 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery20-Oct-07 5:31
Mark Salsbery20-Oct-07 5:31 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery2-Oct-07 8:40
Mark Salsbery2-Oct-07 8:40 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery3-Oct-07 12:59
Mark Salsbery3-Oct-07 12:59 
AnswerRe: Need a best possible alternative?? Pin
Nelek27-Sep-07 21:19
protectorNelek27-Sep-07 21:19 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish1-Oct-07 10:46
Kiran Satish1-Oct-07 10:46 
GeneralRe: Need a best possible alternative?? Pin
Nelek2-Oct-07 10:19
protectorNelek2-Oct-07 10:19 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery9-Oct-07 6:04
Mark Salsbery9-Oct-07 6:04 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish18-Jun-08 17:55
Kiran Satish18-Jun-08 17:55 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery19-Jun-08 6:40
Mark Salsbery19-Jun-08 6:40 

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.