bug with printer example

Just starting out? Need help? Post your questions and find answers here.
Rich Dersheimer
New User
New User
Posts: 7
Joined: Mon Oct 14, 2019 4:40 pm

bug with printer example

Post by Rich Dersheimer »

I'm a new user, and I'm using PureBasic to do some printing. This example code works fine:

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Printer example file
;
;    (c) Fantaisie Software
;
; ------------------------------------------------------------
;

If PrintRequester()

  If StartPrinting("PureBasic Test")
  
    LoadFont(0, "Arial", 30)
    LoadFont(1, "Arial", 100)
  
    If StartDrawing(PrinterOutput())
      
      BackColor(RGB(255, 255, 255)) ; Uses white as back color, usuful when printing on a white sheet
      FrontColor(RGB(0, 0, 0)) ; Use black for standard text color
      
      DrawingFont(FontID(0))
      DrawText(100, 100, "PureBasic Printer Test")
      
      DrawingFont(FontID(1))
      DrawText(100, 400, "PureBasic Printer Test 2")
    
      If LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/PureBasic.bmp")
        DrawImage(ImageID(0), 200, 600)
      Else
        MessageRequester("Error","Can't load the image")
      EndIf
      
      Box(200, 1000, 100, 100, RGB(255, 0, 0)) ; Draw a red box
        
      StopDrawing()
    EndIf
    
    StopPrinting()
  EndIf
EndIf
However, if I remove the lines that load and print the image, the compile crashes with:

Code: Select all

[10:24:10] Waiting for executable to start...
[10:24:10] Executable type: Windows - x64  (64bit, Unicode)
[10:24:10] Executable started.
[10:24:16] The debugged executable quit unexpectedly.
I can leave the code in and comment out the DrawImage() statement, and it works fine.

Rich Dersheimer
Little John
Addict
Addict
Posts: 4812
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: bug with printer example

Post by Little John »

Rich Dersheimer wrote:This example code works fine
Works fine here, too.
Rich Dersheimer wrote:However, if I remove the lines that load and print the image, the compile crashes with:

Code: Select all

[10:24:10] Waiting for executable to start...
[10:24:10] Executable type: Windows - x64  (64bit, Unicode)
[10:24:10] Executable started.
[10:24:16] The debugged executable quit unexpectedly.
I cannot confirm that. If I remove the lines

Code: Select all

      If LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/PureBasic.bmp")
        DrawImage(ImageID(0), 200, 600)
      Else
        MessageRequester("Error","Can't load the image")
      EndIf
then the compiler does NOT crash here.
The difference is just that the output now does not contain the image "PureBasic.bmp", as expected
(using PB 5.71 LTS x64 on Windows 10 Pro).
Rich Dersheimer
New User
New User
Posts: 7
Joined: Mon Oct 14, 2019 4:40 pm

Re: bug with printer example

Post by Rich Dersheimer »

Little John wrote: then the compiler does NOT crash here.
The difference is just that the output now does not contain the image "PureBasic.bmp", as expected
(using PB 5.71 LTS x64 on Windows 10 Pro).
Same version of PB, but I'm on an older Windows 7 potato, which might account for the problem?
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: bug with printer example

Post by Josh »

Tested with:
Win7 x64
Pb 5.71

No problem
sorry for my bad english
Fred
Administrator
Administrator
Posts: 18390
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: bug with printer example

Post by Fred »

Doesn't crash here as well, can anybody confirm ?
Mesa
Enthusiast
Enthusiast
Posts: 460
Joined: Fri Feb 24, 2012 10:19 am

Re: bug with printer example

Post by Mesa »

No problem with XP32b and Pb 5.71

M.
Post Reply