by Otto » Mon Jul 12, 2021 8:30 am
Hello Manuel,
I found this code but do not know how to use.
Best regards,
Otto
Once the DEVMODE structure has been modified to suit our configuration, we can either create a
printer device context using the CreateDC API call:
Code: Select all
HDC hDC = CreateDC( _T( "winspool" ), szPrinter, NULL, lpDevMode );
Or make this configuration as the default for this printer and for all applications using this printer.
DWORD dw;
PRINTER_INFO_2 *pi2;
// get default printer info structure which contains the DEVMODE
GetPrinter( m_hPrinter, 2, NULL, 0, &dw );
pi2 = (PRINTER_INFO_2 *)GlobalAllocPtr( GHND, dw );
GetPrinter( m_hPrinter, 2, (LPBYTE)pi2, dw, &dw );
// set the new printer info structure
pi2->pDevMode = lpDevMode;
SetPrinter( m_hPrinter, 2, (LPBYTE)pi2, 0 );
GlobalFreePtr( pi2 );
// notify applications that the default DEVMODE has changed
SendMessageTimeout( HWND_BROADCAST, WM_DEVMODECHANGE, 0, (LPARAM)szPrinter,
SMTO_NORMAL, 1000, NULL );
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club********************************************************************