Click here to Skip to main content
15,914,066 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: (modeless?)dialog in sdi Pin
frx9616-Feb-09 15:08
frx9616-Feb-09 15:08 
QuestionReplacing or Changing open/save file dialog for winXP and vista Pin
Gilvinit16-Feb-09 9:31
Gilvinit16-Feb-09 9:31 
AnswerRe: Replacing or Changing open/save file dialog for winXP and vista Pin
David Crow16-Feb-09 9:47
David Crow16-Feb-09 9:47 
QuestionPrinting using GDI Pin
Steve_16-Feb-09 8:59
Steve_16-Feb-09 8:59 
AnswerRe: Printing using GDI Pin
Code-o-mat16-Feb-09 10:31
Code-o-mat16-Feb-09 10:31 
GeneralRe: Printing using GDI Pin
Steve_16-Feb-09 10:40
Steve_16-Feb-09 10:40 
AnswerRe: Printing using GDI Pin
frx9616-Feb-09 14:33
frx9616-Feb-09 14:33 
AnswerRe: Printing using GDI Pin
frx9616-Feb-09 14:33
frx9616-Feb-09 14:33 
static bool CheckPrinterStretchDibSupport(HWND hwndForMsgBox, HDC hdc)
{
// most printers can support stretchdibits,
// whereas a lot of printers do not support bitblt
// quit if printer doesn't support StretchDIBits
int rasterCaps = GetDeviceCaps(hdc, RASTERCAPS);
int supportsStretchDib = rasterCaps & RC_STRETCHDIB;
if (supportsStretchDib)
return true;

MessageBox(hwndForMsgBox, "This printer doesn't support StretchDIBits function", "Printing problem.", MB_ICONEXCLAMATION | MB_OK);
return false;
}


static void PrintToDevice(DisplayModel *dm, HDC hdc, LPDEVMODE devMode, int nPageRanges, LPPRINTPAGERANGE pr, int printRange = 0) {
................
DOCINFO di = {0};
di.cbSize = sizeof (DOCINFO);
di.lpszDocName = filename;

if (StartDoc(hdc, &di) <= 0)
return;
.................
SetMapMode(hdc, MM_TEXT);

int printAreaWidth = GetDeviceCaps(hdc, HORZRES);
int printAreaHeight = GetDeviceCaps(hdc, VERTRES);

int topMargin = GetDeviceCaps(hdc, PHYSICALOFFSETY);
int leftMargin = GetDeviceCaps(hdc, PHYSICALOFFSETX);
.........
// use pixel sizes for printer with non square pixels
float fLogPixelsx= (float)GetDeviceCaps(hdc, LOGPIXELSX);
float fLogPixelsy= (float)GetDeviceCaps(hdc, LOGPIXELSY);

bool bPrintPortrait=fLogPixelsx*printAreaWidth<flogpixelsy*printareaheight;>
BOOL isSameFile = IsSameFile(dm);
int realWidth = printAreaWidth;
int realHeight = printAreaHeight;

// print all the pages the user requested unless
// bContinue flags there is a problem.
for (int i=0; i < nPageRanges; i++) {
assert(pr->nFromPage <= pr->nToPage);
for (DWORD pageNo = pr->nFromPage; pageNo <= pr->nToPage; pageNo++) {
............
StartPage(hdc);
..............
bmp->stretchDIBits(hdc, leftMargin, topMargin, realWidth, realHeight);
delete bmp;
if (EndPage(hdc) <= 0) {
AbortDoc(hdc);
return;
}
}
pr++;
}
Error:
EndDoc(hdc);
}
AnswerRe: Printing using GDI Pin
frx9616-Feb-09 14:36
frx9616-Feb-09 14:36 
AnswerRe: Printing using GDI Pin
«_Superman_»16-Feb-09 18:16
professional«_Superman_»16-Feb-09 18:16 
AnswerRe: Printing using GDI Pin
Iain Clarke, Warrior Programmer18-Feb-09 1:52
Iain Clarke, Warrior Programmer18-Feb-09 1:52 
QuestionHow to compile a native (ie. using NT API instead of Win32) x64 app ? Pin
Defenestration16-Feb-09 7:50
Defenestration16-Feb-09 7:50 
AnswerRe: How to compile a native (ie. using NT API instead of Win32) x64 app ? Pin
Richard Andrew x6416-Feb-09 16:30
professionalRichard Andrew x6416-Feb-09 16:30 
AnswerRe: How to compile a native (ie. using NT API instead of Win32) x64 app ? Pin
«_Superman_»16-Feb-09 18:19
professional«_Superman_»16-Feb-09 18:19 
QuestionProblem with dll... Pin
Member Ártemis16-Feb-09 5:28
Member Ártemis16-Feb-09 5:28 
AnswerRe: Problem with dll... Pin
Taran916-Feb-09 6:03
Taran916-Feb-09 6:03 
GeneralRe: Problem with dll... Pin
Member Ártemis16-Feb-09 7:09
Member Ártemis16-Feb-09 7:09 
AnswerRe: Problem with dll... Pin
CPallini16-Feb-09 6:52
mveCPallini16-Feb-09 6:52 
GeneralRe: Problem with dll... Pin
Member Ártemis16-Feb-09 7:18
Member Ártemis16-Feb-09 7:18 
GeneralRe: Problem with dll... Pin
CPallini16-Feb-09 7:38
mveCPallini16-Feb-09 7:38 
GeneralRe: Problem with dll... Pin
regnwald16-Feb-09 18:44
regnwald16-Feb-09 18:44 
GeneralRe: Problem with dll... Pin
CPallini16-Feb-09 21:34
mveCPallini16-Feb-09 21:34 
GeneralRe: Problem with dll... Pin
CPallini16-Feb-09 21:44
mveCPallini16-Feb-09 21:44 
AnswerRe: Problem with dll... Pin
Richard Andrew x6416-Feb-09 16:37
professionalRichard Andrew x6416-Feb-09 16:37 
GeneralRe: Problem with dll... Pin
Member Ártemis16-Feb-09 23:04
Member Ártemis16-Feb-09 23:04 

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.