Advertisement
| 10.23.2008 at 03:44AM PDT, ID: 23840202 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: |
void PrintScreen (HWND hWnd)
{
HDC hScreenDC;
if ((hScreenDC = GetDC (hWnd)) != NULL) {
HDC hMemDC;
if ((hMemDC = CreateCompatibleDC (hScreenDC))!= NULL) {
HBITMAP hFullScreenBitmap;
int iScreenWidth = GetSystemMetrics (SM_CXFULLSCREEN);
int iScreenHeight = GetSystemMetrics (SM_CYFULLSCREEN);
if ((hFullScreenBitmap = CreateCompatibleBitmap (hScreenDC, iScreenWidth, iScreenHeight)) != NULL) {
HBITMAP hDefaultBitmap = (HBITMAP) SelectObject (hMemDC, hFullScreenBitmap);
// From screen to memory:
BitBlt (hMemDC, 0, 0, iScreenWidth, iScreenHeight, hScreenDC, 0, 0, SRCCOPY);
SelectObject (hMemDC, hDefaultBitmap);
SelectObject (hMemDC, hFullScreenBitmap);
// Printing:
PRINTDLG pd = {0}; // Reset on declare
pd.lStructSize = sizeof (pd);
pd.Flags = PD_RETURNDEFAULT | PD_ALLPAGES | PD_RETURNDC;
pd.nFromPage = 1;
pd.nToPage = 1;
pd.nCopies = 1;
if (PrintDlg (&pd)) {
if (pd.hDC) {
// Scaling to fit on a printer page:
double dblScreenRatio = (double) iScreenWidth / (double) iScreenHeight;
int xPrnPixelsPerPage = GetDeviceCaps (pd.hDC, PHYSICALWIDTH);
int xPrnPixelsMargin = GetDeviceCaps (pd.hDC, PHYSICALOFFSETX);
int yPrnPixelsMargin = GetDeviceCaps (pd.hDC, PHYSICALOFFSETY);
int printedWidth = xPrnPixelsPerPage - xPrnPixelsMargin * 2;
int printedHeight = (int) ((double) printedWidth / dblScreenRatio);
DOCINFO di = {0};
di.cbSize = sizeof (di);
di.lpszDocName = "Print Full Screen";
StartDoc (pd.hDC, &di);
StartPage (pd.hDC);
// FINALLY!
StretchBlt (pd.hDC,
xPrnPixelsMargin, yPrnPixelsMargin, printedWidth, printedHeight,
hMemDC, 0, 0, iScreenWidth, iScreenHeight, SRCCOPY);
EndPage (pd.hDC);
EndDoc (pd.hDC);
DeleteDC (pd.hDC);
}
// Clean up after print dlg:
if (pd.hDevMode) {
GlobalFree (pd.hDevMode);
}
if (pd.hDevNames) {
GlobalFree (pd.hDevNames);
}
}
SelectObject (hMemDC, hDefaultBitmap);
DeleteObject (hFullScreenBitmap);
}
DeleteDC (hMemDC);
}
ReleaseDC (NULL, hScreenDC);
}
}
|
Advertisement