Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printing Problem

Posted on 2003-10-22
3
Medium Priority
?
208 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 200 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

722 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