Page 1 of 1

PrnGetName() problem

Posted: Fri Dec 01, 2006 4:01 pm
by Roger Seiler
Antonio,

In rare cases where a workstation has a default printer selected that is a printer attached to another workstation that happens to be turned off, calling PrnGetName() can cause a GPF.

Perhaps, when you have a chance, you could modify the C code in PrintDC.c for this function so that it will trap this situation and prevent the GPF. Perhaps a way to do this, in such a case, is to display the standard printer selection dialog so that the user can select another active printer to be the default.

- Roger

Posted: Sat Dec 02, 2006 7:09 pm
by Antonio Linares
Roger,

This may be a fix for it. We appreciate your feedback,

Code: Select all


CLIPPER PRNGETNAME( PARAMS ) // () --> cPrinter
{
   LPDEVNAMES lpDevNames;

   PrinterInit();

   if( pd.hDevNames )
   {
      lpDevNames = (LPDEVNAMES) GlobalLock( pd.hDevNames );

      if( lpDevNames )
      {
         _retc( ( LPSTR ) lpDevNames + lpDevNames->wDeviceOffset );
        GlobalUnlock( pd.hDevNames );
      }
      else
         _retc( "" );
   }
   else
      _retc( "" );
}