Silverfrost Forums

Welcome to our forums

Graphics Region to Printer

9 Dec 2010 12:13 #7215

I have a complex program developed a couple of years ago which copies from graphics regions to the printer. At the time it worked fine under both Vista and XP.

The basic code below compiled under V5.5 (and run with v5.5 salflibc.dll) works fine on XP machines but blows up with a BSoD - Page fault in nonpaged area - on both a Vista machine and 2 Windows 7 32 bit machines.

I hope I have made some basic error and would be most grateful for any suggestions.

Bill

  winapp 
  include <windows.ins>
  call open_printer@(1)
  call create_graphics_region@(2,100,100)
  call draw_filled_rectangle@(10,10,80,80,2)
  call copy_graphics_region@(1,50,50,100,100,2,0,0,100,100,SRCCOPY)
  call select_graphics_object@(1)
  call perform_graphics_update@
  call close_printer@(1)
  end
9 Dec 2010 11:31 #7218

Bill,

I can not help with your program problem, but my approach to printing is to save the graphics region to a .gif file. I create the pictures by selecting a menu > Dump option in my clearwin+ program, with automated generation of the .gif file name. I then copy the .gif files into a word document (using insert > picture > from file...), simply to print or to include in a report. I find it useful to have the .gif files stored for past projects. I do all the scaling, croping etc in word or other suttable programs. It's all manual, which may not suit your use. This seperates the program running from the printer queues, which is all I have available on the network I use. This may make it easier to manage different O/S and printers.

John

10 Dec 2010 8:25 #7219

Dear John,

Many thanks for your thoughts - I already do create .JPG and clipboard images using buttons / mouse actions and use the graphics region(s) to display to screen. As documented one should be able to copy to printer as per this simple example drawing a small square!

For anyone else looking at the above code the compilation was done on a 32 bit Win 7 machine using Silverfrost 5.5. Will try out v6 to see if the problem also occurs then.

Many Thanks

Bill

11 Dec 2010 4:51 #7225

Bill,

I think that the problem maybe the printer driver not being able to scale the graphic. I had a similar problem once that I overcame by copying (and scaling) the graphics image to an offscreen plotting area and then doing a one for one copy (ie no scaling) from this to the printer.

Hope this helps

Brian

11 Dec 2010 1:11 #7229

Dear Brian,

Many thanks for the very sensible suggestion however the BSoD error problem still occurs (to a variety of physical and virtual printers) when the size is the same. In the debugger the graphical resolution is returned with values as expected and itest returns as = 1 to apparently confirm successful copy but when graphics_update / close printer is reached the machine(s) reboot under W7 or Vista but is fine under XP. The same problem occurs with both V5.5 and v6.0.

Any ideas would be very gratefully received!

  winapp 
  include <windows.ins>
  call open_printer@(1)
  call get_graphical_resolution@(iwidth,iheight)      
  call create_graphics_region@(8,iwidth,iheight)
  call select_graphics_object@(8)
  call draw_filled_rectangle@(10,10,80,80,2)
  
  itest = copy_graphics_region@(1,0,0,iwidth,iheight,8,0,0,iwidth,iheight,SRCCOPY)
  call select_graphics_object@(1)
  call perform_graphics_update@
  call close_printer@(1)
  end
16 Dec 2010 9:49 #7252

You get a BSOD from that code? In theory a BSOD cannot be caused by anything you can write in FTN95. A BSOD can only occur if there is a problem in the kernel and your programs, ClearWin+ and salflibc all run in user mode. This is almost certainly caused by a driver bug, possibly in your screen driver. Can you post the BSOD (you may need a camera!)

16 Dec 2010 2:43 #7255

Thanks for looking at this Robert

The problem as experienced on 3 different machines is shown here:

http://www.goweralg.co.uk/silverfrost/index.htm

Any suggestions would be much appreciated.

Bill

20 Dec 2010 9:09 #7261

I have tried you example on a few machines (with my teeth gritted, waiting for a reboot) and they have just worked. I have tried Vista and Windows 7 machines. Is there something in common between you machines - like a common video card?

20 Dec 2010 4:26 #7263

Dear Robert,

Many thanks for trying this out. It is at least a relief to find that this may be related to machines. Two of the three machines (but not the notebook) do have the same card - the only thing in common between the 3 is Norton 2011 (???) which I did briefly try disabling. I will spend the next couple of weeks trying out various things and finding more varied machines to test things out on and report back.

Many thanks again and a Happy Christmas

Bill

5 Jan 2011 2:25 #7369

I am relieved to say that I have now been able to overcome this problem.

It proved to be an issue with 3 different printer drivers I have on my machine. Updating these using Windows update did nothing, but deleting all the printers completely and then re-installing via Windows update has re-enabled the copy_graphics_region to printer successfully! I now know a lot more about minidump files - but that proved useless in solving the problem! Thanks to all for their help and suggestions - and a Happy New Year!

5 Jan 2011 5:57 #7375

At lease there is a resolution - although I cannot help but think that is a bug in Windows. A BSOD from a printer driver should be impossible.

Please login to reply.