Solved

Printing Problem

Posted on 2003-10-22
3
205 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 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

617 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