Dear Mr. Rao, dear Antonio,
My problem is that I need to print from TActiveX.
It seems that Fivewin creates a printer device context and not makes the default for this printer for all applications.
Printing from the web browser control I think is a different application.
Therefore, I would need the changes for all applications.
Can you please help me?
Best regards,
Otto
https://www.amyuni.com/forum/viewtopic.php?t=1224Once 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.
Code: Select all
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 );