Page 1 of 1

Error with PrintImage function after windows 10 update

Posted: Sun Mar 14, 2021 6:32 pm
by MaxP
Hi All,

after the latest windows 10 update Version 20H2 x64 (KB5000802)
the oPrn:PrintImage function does not work properly.

Code: Select all

#include "FiveWin.ch"
#include "Image.ch"

//----------------------------------------------------------------------------//

function Main()

   LOCAL oDlg, oImage, lSetAlpha := .t.

//   setalpha( .f. )

   DEFINE DIALOG oDlg FROM 0, 0 TO 22, 60 ;
      TITLE FWDESCRIPTION + " JPG,JIF,GIF,BMP,DIB,RLE,TGA,PCX support!"

   @ 0, 0 IMAGE oImage SIZE 150, 150 OF oDlg SCROLL // ADJUST

   oImage:Progress( .f. )

   @ 1, 28 BUTTON "Select Image" SIZE 50,10 OF oDlg ACTION GetImage( oImage )

   @ 2, 28 BUTTON "Print" SIZE 50,10 OF oDlg ACTION PrintImage( oImage )

   @ 3, 28 BUTTON "Copy" SIZE 50, 10 OF oDlg ;
      ACTION oImage:CopyToClipboard()

   @ 4, 28 BUTTON "Paste" SIZE 50, 10 OF oDlg ;
      ACTION ( oImage:LoadFromClipboard(), oImage:Refresh() )

   @ 5, 28 BUTTON "Save" SIZE 50, 10 OF oDlg ;
      ACTION ( oImage:SaveImage( "SAVED.JPG", 2, 25 ), MsgInfo( "saved as saved.jpg" ) )

   @ 6, 28 BUTTON "Exit" SIZE 50, 10 OF oDlg ACTION oDlg:End()
   
   @ 10, 26 CHECKBOX oImage:lStretch PROMPT "Stretch" SIZE 50, 10 OF oDlg ;
      ON CHANGE ( oImage:ScrollAdjust(), oImage:Refresh() )

   @ 11, 26 CHECKBOX lSetAlpha PROMPT "Set Alpha Channel" SIZE 80, 10 OF oDlg ;
      ON CHANGE ( SetAlpha( lSetAlpha ), oImage:Refresh() )


   ACTIVATE DIALOG oDlg CENTER

return nil

//----------------------------------------------------------------------------//

function GetImage( oImage )

   local gcFile := cGetFile( "Bitmap (*.bmp)| *.bmp|" +         ;
                             "DIB   (*.dib)| *.dib|" +          ;
                             "PCX   (*.pcx)| *.pcx|"  +         ;
                             "JPEG  (*.jpg)| *.jpg|" +          ;
                             "GIF   (*.gif)| *.gif|"  +         ;
                             "TARGA (*.tga)| *.tga|" +          ;
                             "RLE   (*.rle)| *.rle|" +          ;
                             "All Files (*.*)| *.*"             ;
                            ,"Please select a image file", 4 )

   if ! Empty( gcFile ) .and. File( gcFile )
      oImage:LoadBmp( gcFile )
   endif

return nil

//----------------------------------------------------------------------------//

function PrintImage( oImage )

   local oPrn

   PRINT oPrn NAME "Image Printing" PREVIEW
      PAGE
         oPrn:PrintImage( 0, 0, oImage )
      ENDPAGE
   ENDPRINT

return nil

//----------------------------------------------------------------------------//

procedure AppSys   // XBase++ requirement

return

//----------------------------------------------------------------------------//
Tools used:
Fivewin 19.09
Borland 5.82

Some idea ?

Regards
Massimo