// Allocate a global handle for DEVMODE
HGLOBAL hDevMode = GlobalReAlloc(m_hDevMode, sizeof(*p2->pDevMode) + p2->pDevMode->dmDriverExtra, GHND);
DEVMODE* pDevMode = (DEVMODE*)GlobalLock(hDevMode);
// copy DEVMODE data from PRINTER_INFO_2::pDevMode
memcpy(pDevMode, p2->pDevMode, sizeof(*p2->pDevMode) + p2->pDevMode->dmDriverExtra);
// Compute size of DEVNAMES structure from PRINTER_INFO_2's data
DWORD drvNameLen = lstrlen(p2->pDriverName)+1; // driver name
DWORD ptrNameLen = lstrlen(p2->pPrinterName)+1; // printer name
DWORD porNameLen = lstrlen(p2->pPortName)+1; // port name
// Allocate a global handle big enough to hold DEVNAMES.
HGLOBAL hDevNames = GlobalReAlloc(m_hDevNames, sizeof(DEVNAMES) + (drvNameLen + ptrNameLen + porNameLen)*sizeof(TCHAR), GHND);
DEVNAMES* pDevNames = (DEVNAMES*)GlobalLock(hDevNames);
// Copy the DEVNAMES information from PRINTER_INFO_2
// tcOffset = TCHAR Offset into structure
int tcOffset = sizeof(DEVNAMES)/sizeof(TCHAR);
ASSERT(sizeof(DEVNAMES) == tcOffset*sizeof(TCHAR));
I've having a problem with loading print setups saved from W2K in XP and visa-verse. In my case I've a EPSON 2100 and the dmPrintQuality param is not loaded correctly across the OS's. Saving/Loading from the same! OS seems to work ok.
Does anyone has a (quick and dirty??) solution? .
Currently I've two saved to setup's MyPrintEPSON2100-XP and
Modifying printer default setting in dialog based application
Posted by Legacy
on 08/02/2003 12:00am
Originally posted by:
Many thanks to the earlier posters. The following is an example of what worked in a dialog based application where I wanted to use the CPrintDialog DoModal function where a user could change printer options but where I wanted to printer dialog box to open with certain defaults already in place ( such as for printing out an envelope ). This was in a function in the Dlg class, not the App class.
When the print dialog box opens the defaults are set to #10 envelope and landscape orientation typical for most envelopes. The user still can change to something else ( another sized envelope if needed ).
I have to build an application that manages all operations of a desktop such as count number operations that are sucessful/fail or canceled...But i don't know where to begin: which hooks i have to use,how to use it...
i need help...
Pl can anybody help me...
I need to restrict getting printouts. Such that I need to set a password on any printing job (Ms Word, Notepad, Adobe, etc.) and control the no of printouts allowed.(In VB or c++)
If some one can help me on this would greately appreciated
i am using the class CView for printing. So, i want to set the page size of(800x480) pixels which will show in print preview. since when i saw print preview it showing things on approx half of the page. So, anyone can help me.
thanks in advance.