i have these code for work with printer:
Code:
void print()
{
string windowtitle;
GetWindowString(hwnd,windowtitle);
DOCINFO doc = {sizeof(DOCINFO), windowtitle.c_str()};
unsigned long lPrinterNameLength;
GetDefaultPrinter( NULL, &lPrinterNameLength );
char szPrinterName[lPrinterNameLength];
GetDefaultPrinter( szPrinterName, &lPrinterNameLength );
//DebugText(szPrinterName);
HDC pDC =CreateDC( "WINSPOOL",szPrinterName, NULL, NULL);
StartDoc(pDC, &doc);
StartPage(pDC);
HDC windowDC=GetDC(hwnd);
RECT windowrect;
GetClientRect(hwnd, &windowrect);
int w = windowrect.right;
int h = windowrect.bottom;
StretchBlt(pDC, 0,0, w, h, windowDC, 0, 0, windowrect.right, windowrect.bottom, SRCCOPY);
EndPage (pDC);
EndDoc(pDC);
DeleteDC(pDC);
ReleaseDC(hwnd,windowDC);
DeleteDC(windowDC);
}
how can i convert the h,w from pixels to twips?
i have seen several codes but without sucess
can anyone explain to me how can i do it?
(the image printed is correct, but very small)