forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Graphics Region to Printer

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
BILLDOWS



Joined: 22 Jul 2005
Posts: 86
Location: Swansea, UK

PostPosted: Thu Dec 09, 2010 1:13 pm    Post subject: Graphics Region to Printer Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
JohnCampbell



Joined: 16 Feb 2006
Posts: 1808
Location: Sydney

PostPosted: Fri Dec 10, 2010 12:31 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
BILLDOWS



Joined: 22 Jul 2005
Posts: 86
Location: Swansea, UK

PostPosted: Fri Dec 10, 2010 9:25 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Smib



Joined: 26 Apr 2009
Posts: 19
Location: Melbourne

PostPosted: Sat Dec 11, 2010 5:51 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
BILLDOWS



Joined: 22 Jul 2005
Posts: 86
Location: Swansea, UK

PostPosted: Sat Dec 11, 2010 2:11 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Robert



Joined: 29 Nov 2006
Posts: 220
Location: Manchester

PostPosted: Thu Dec 16, 2010 10:49 am    Post subject: Reply with quote

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!)
Back to top
View user's profile Send private message Visit poster's website
BILLDOWS



Joined: 22 Jul 2005
Posts: 86
Location: Swansea, UK

PostPosted: Thu Dec 16, 2010 3:43 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Robert



Joined: 29 Nov 2006
Posts: 220
Location: Manchester

PostPosted: Mon Dec 20, 2010 10:09 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message Visit poster's website
BILLDOWS



Joined: 22 Jul 2005
Posts: 86
Location: Swansea, UK

PostPosted: Mon Dec 20, 2010 5:26 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
BILLDOWS



Joined: 22 Jul 2005
Posts: 86
Location: Swansea, UK

PostPosted: Wed Jan 05, 2011 3:25 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message Visit poster's website
Robert



Joined: 29 Nov 2006
Posts: 220
Location: Manchester

PostPosted: Wed Jan 05, 2011 6:57 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group