guimasun
March 4th, 2008, 08:52 PM
I'd like to save the HDC content obtainbed from GetPrinterDC (which has just one ellipse drawn on it) to a .EMF file, I've tried with a window HDC and it works fine, but the same do not occurs with the printer related HDC.
Everything I have is a Printer HDC received from an unknown app. I'm not getting even a simple copy from the HDC using BitBlt alike functions.
The function I've used just for for tests is below.
Thanks for any tip !
void PrintStuff( HWND hWndParent )
{
HDC hDC;
DOCINFO di;
hDC = GetPrinterDC();
InitDocStruct( &di, "MyDoc");
StartDoc( hDC, &di );
StartPage( hDC );
HPEN newPen = CreatePen(PS_SOLID,50,RGB(0,0,0));
HPEN oldPen = (HPEN)SelectObject(hdc,newPen);
Ellipse(hdc, 0, 0, 200, 200);
******** I'D LIKE TO SAVE HDC TO AN EMF HERE
EndPage( hDC );
EndDoc( hDC );
DeleteDC( hDC );
}
Everything I have is a Printer HDC received from an unknown app. I'm not getting even a simple copy from the HDC using BitBlt alike functions.
The function I've used just for for tests is below.
Thanks for any tip !
void PrintStuff( HWND hWndParent )
{
HDC hDC;
DOCINFO di;
hDC = GetPrinterDC();
InitDocStruct( &di, "MyDoc");
StartDoc( hDC, &di );
StartPage( hDC );
HPEN newPen = CreatePen(PS_SOLID,50,RGB(0,0,0));
HPEN oldPen = (HPEN)SelectObject(hdc,newPen);
Ellipse(hdc, 0, 0, 200, 200);
******** I'D LIKE TO SAVE HDC TO AN EMF HERE
EndPage( hDC );
EndDoc( hDC );
DeleteDC( hDC );
}