Solved

Printing Problem

Posted on 2003-10-22
3
198 Views
Last Modified: 2013-11-20
How Do I set the default Printer setting to B&W for a color printer without using the default property dialog box?
0
Comment
Question by:rpatna
3 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 9604887
See sample code in MSDN topic CWinApp::GetPrinterDeviceDefaults .

void CMyApp::SetMonochrome()
{
   PRINTDLG pd;
   pd.lStructSize=(DWORD)sizeof(PRINTDLG);
   BOOL bRet=GetPrinterDeviceDefaults(&pd);
   if(bRet)
   {
      // protect memory handle with ::GlobalLock and ::GlobalUnlock
      DEVMODE FAR *pDevMode=(DEVMODE FAR *)::GlobalLock(m_hDevMode);
      // set monochrome mode
      pDevMode->dmColor=DMCOLOR_MONOCHROME;
      ::GlobalUnlock(m_hDevMode);
   }
}

0
 

Author Comment

by:rpatna
ID: 9626765
The problem was to get a B&W printout of a color image(bitmap). The solution given may not be apropriate for this particular problem as it didnot worked in my case.
0
 

Accepted Solution

by:
ashokRaut earned 50 total points
ID: 9626814
Try this:

HBITMAP hMonocrome = CreateBitMap( ( WORD )lpbi->biWidth, ( WORD )lpbi->biHeight, 1, 1, NULL) ;  

SetDIBits( hDC, hMonocrome, 0, lpbi->Height, (LPSTR)lpbi + lpbi->biSize + nColors *size0f(RGBQUAD) , (LPBITMAPINFO)lpbi, IB_RGB_COLORS ) ;


REFER TO: MNDN Topic Bit2Mono.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question