Click here to Skip to main content
15,900,818 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Generating/exporting a PDF from my MFC application, for reports that are created by overloading OnDraw in a view Pin
Sternocera30-Apr-09 23:55
Sternocera30-Apr-09 23:55 
GeneralRe: Generating/exporting a PDF from my MFC application, for reports that are created by overloading OnDraw in a view Pin
Rajesh R Subramanian1-May-09 0:01
professionalRajesh R Subramanian1-May-09 0:01 
GeneralRe: Generating/exporting a PDF from my MFC application, for reports that are created by overloading OnDraw in a view Pin
Sternocera1-May-09 0:03
Sternocera1-May-09 0:03 
GeneralRe: Generating/exporting a PDF from my MFC application, for reports that are created by overloading OnDraw in a view Pin
Rajesh R Subramanian1-May-09 0:11
professionalRajesh R Subramanian1-May-09 0:11 
GeneralRe: Generating/exporting a PDF from my MFC application, for reports that are created by overloading OnDraw in a view Pin
Sternocera1-May-09 0:15
Sternocera1-May-09 0:15 
QuestionIs there a way to draw standard controls to bitmap if they aren't on the screen? Pin
Entrase30-Apr-09 22:04
Entrase30-Apr-09 22:04 
AnswerRe: Is there a way to draw standard controls to bitmap if they aren't on the screen? Pin
Code-o-mat30-Apr-09 22:51
Code-o-mat30-Apr-09 22:51 
GeneralRe: Is there a way to draw standard controls to bitmap if they aren't on the screen? Pin
Entrase3-May-09 2:04
Entrase3-May-09 2:04 
Thanks! It works! But there is something wrong with the alpha channel.

[img]http://smages.com/i/0c/74/0c74a1f057b9a7e17a0c27e2b4dd4766.png[/img]

I'm creating 32-bpp bitmap and asking the button do draw itself there with WM_PRINTCLIENT. What's wrong?

hdc = GetDC(hWnd);
hdcMemory = CreateCompatibleDC(hdc);

nBytesPerLine = ((szWin.cx * 32 + 31) & (~31)) >> 3;
stBmpInfoHeader.biSize = sizeof(BITMAPINFOHEADER);
stBmpInfoHeader.biWidth = szWin.cx;
stBmpInfoHeader.biHeight = szWin.cy;
stBmpInfoHeader.biPlanes = 1;
stBmpInfoHeader.biBitCount = 32;
stBmpInfoHeader.biCompression = BI_RGB;
stBmpInfoHeader.biClrUsed = 0;
stBmpInfoHeader.biSizeImage = nBytesPerLine * szWin.cy;

void* pvBits;
hbmpMem = CreateDIBSection(NULL, (PBITMAPINFO)&stBmpInfoHeader, DIB_RGB_COLORS, &pvBits, NULL, 0);
memset(pvBits, 0x88, szWin.cx * szWin.cy * 4);
if (hbmpMem)
{
	HGDIOBJ hbmpOld = SelectObject(hdcMemory, hbmpMem);
	//TextOut(hdcMemory, 10, 10, L"Text", 4);
	SendMessage(ctrl, WM_PRINTCLIENT, (WPARAM)hdcMemory, PRF_CLIENT | PRF_CHILDREN | PRF_OWNED);
	//BitBlt(hdc, 0, 0, szWin.cx, szWin.cy, hdcMemory, 0, 0, SRCCOPY);
	BLENDFUNCTION stBlend;
	stBlend.AlphaFormat = AC_SRC_ALPHA;
	stBlend.BlendFlags = 0;
	stBlend.BlendOp = AC_SRC_OVER;
	stBlend.SourceConstantAlpha = 255;
	//AlphaBlend(hdc, 0, 0, szWin.cx, szWin.cy, hdcMemory, 0, 0, szWin.cx, szWin.cy, stBlend);
	UpdateLayeredWindow(hWnd, hdc, &ptWinPos, &szWin, hdcMemory, &ptSrc, 0, &stBlend, ULW_ALPHA);
	SelectObject(hdcMemory, hbmpOld);
	DeleteObject(hbmpMem);
}
DeleteDC(hdcMemory);
DeleteDC(hdc);

GeneralRe: Is there a way to draw standard controls to bitmap if they aren't on the screen? Pin
Code-o-mat3-May-09 2:32
Code-o-mat3-May-09 2:32 
GeneralRe: Is there a way to draw standard controls to bitmap if they aren't on the screen? Pin
Entrase4-May-09 2:30
Entrase4-May-09 2:30 
GeneralRe: Is there a way to draw standard controls to bitmap if they aren't on the screen? Pin
Code-o-mat4-May-09 2:33
Code-o-mat4-May-09 2:33 
QuestionCheck for empty buffer Pin
CodingLover30-Apr-09 18:49
CodingLover30-Apr-09 18:49 
AnswerRe: Check for empty buffer Pin
Joe Woodbury30-Apr-09 19:15
professionalJoe Woodbury30-Apr-09 19:15 
GeneralRe: Check for empty buffer Pin
CPallini30-Apr-09 23:00
mveCPallini30-Apr-09 23:00 
GeneralRe: Check for empty buffer Pin
Rajesh R Subramanian30-Apr-09 23:40
professionalRajesh R Subramanian30-Apr-09 23:40 
GeneralRe: Check for empty buffer Pin
CPallini30-Apr-09 23:47
mveCPallini30-Apr-09 23:47 
GeneralRe: Check for empty buffer Pin
Rajesh R Subramanian30-Apr-09 23:57
professionalRajesh R Subramanian30-Apr-09 23:57 
AnswerRe: Check for empty buffer Pin
Fernando A. Gomez F.30-Apr-09 19:55
Fernando A. Gomez F.30-Apr-09 19:55 
GeneralRe: Check for empty buffer Pin
Joe Woodbury3-May-09 14:17
professionalJoe Woodbury3-May-09 14:17 
GeneralRe: Check for empty buffer Pin
Fernando A. Gomez F.3-May-09 17:47
Fernando A. Gomez F.3-May-09 17:47 
AnswerRe: Check for empty buffer Pin
Eytukan30-Apr-09 20:28
Eytukan30-Apr-09 20:28 
AnswerRe: Check for empty buffer Pin
CPallini30-Apr-09 22:58
mveCPallini30-Apr-09 22:58 
QuestionConvert Ascii to hex.and hex to decimal. Pin
Le@rner30-Apr-09 18:39
Le@rner30-Apr-09 18:39 
AnswerRe: Convert Ascii to hex.and hex to decimal. Pin
Rajesh R Subramanian30-Apr-09 20:47
professionalRajesh R Subramanian30-Apr-09 20:47 
GeneralRe: Convert Ascii to hex.and hex to decimal. Pin
Le@rner30-Apr-09 20:49
Le@rner30-Apr-09 20:49 

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.