Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Printing QuickWin Graphics

onkelhotte
New Contributor II
2,385 Views
Hi there,
Ive had a problem here with printing QuickWin Graphics. Because I do not have the MenuBar with File->Print in my program I started to write a turnaround for that. First I tried to save that window into a .bmp file, that was no problem. Now the user should be able to print that file when he presses a "print diagram" button Ive placed on the dialog. I tried to use the PRINTDLG and DC, but I couldnt get any prints on my printer.
After crawling the Fortran Help I found the command CLICKMENUQQ(loc(WINPRINT)), and with that you can open the normal printing dialog from Fortran. You dont needto save the QuickWin Plot in a .bmp file too. But it should be possible to print .bmp files as well when you open a bitmap with loadimage.
Btw., is it possible to set the page setupto landscape by default? Do I have to set the DEVMODEoptions or something for that?
0 Kudos
14 Replies
david_jones
Beginner
2,385 Views
There has been some previous discussion of this here. Try searching for "winprint". On the topic of landscape printing, Alan Cruttenden developed some code associated with this: this code may also help with your .bmp printing questions. Unfortunately Alan retired and seems not to be in contact with this board, or otherwise. But, since he did try to post the code here, and offered it by e-mail, I think it is OK for me to post it here (see attachment which contains code and documentation). This is the last working version that I know of.
David Jones
0 Kudos
llynisa
Beginner
2,385 Views
I am still reading the forum, but have a bug (along with a few other unfortunate souls) that does not allow me to log on, probably a trouble with IE6. So I cant post messages, and this one is kindly posted by the support staff.
I am quite happy for anyone to use the code posted by David Jones, and although retired, I am still working on Fortran programs. So if any of you have any queries on PrintWin I would be happy if you Emailed me on alan.cruttenden@lineone.net. Where appropriate, I might ask anyone doing so to post our correspondence on the forum.
On the subject of changing the default orientation in Page Setup to Landscape, it was a surprisingly difficult task (for me, anyway) for what looked like an almost trivial change. But now that it is done, it removes another of lifes little irritations.
Regards
Alan Cruttenden

Message Edited by llynisa on 10-13-2004 11:20 AM

0 Kudos
edr
Beginner
2,385 Views
Alan sent me a note that the version posted by David Jones (Version 1.22) is the latest version of Printwin and asked that anyone finding bugs send him an email at the address listed in his post.....
Ed Raney
0 Kudos
edr
Beginner
2,385 Views
The note below is from Alan with some additional information on Printwin..David I sent Alan your email address...
Ed. Raney
"PrintWin is not quite finished however, and cannot currently cope with
Printer Names of over 32 characters in length, a problem flagged up by David
Jones because his network printer addresses were identical in the first 40
or so characters. If David would get in touch with me I will attempt to
rectify the problem using some helpful code posted by Jugoslav (who else!).



Alan Cruttenden"
0 Kudos
anthonyrichards
New Contributor III
2,385 Views
I was hoping to try PrintWin and downloaded the attachment in a post above, but when compiled, it was missing two modules, namely 'errmsg' and GetPrInfo. Help!
0 Kudos
edr
Beginner
2,385 Views
anthony....
I have sent a note to Alan with your information...I know that he has a newer version of PrintWin that works with XP but doesn't work with Win98...He may post to the board but if he doesn't or if you need the older version I'll search out the routines and post them for him....Give it a couple of days or so....I've checked the email button so will get an email when you reply......I'm sure I have them somewhere but they are not immediately available and probably not the newest version....
Ed.Raney
0 Kudos
edr
Beginner
2,385 Views
Anthony:
Alan sent me this updated version of PrintWin and asked that anyone finding errors, having suggestions or other comments please let him (or me) know and/or post them on the forum......I have attached the .zip file to this post (I hope)
Ed.Raney
0 Kudos
anthonyrichards
New Contributor III
2,385 Views
Firstly, thanks for going to the trouble to dig out the code.
Secondly, it fell over on compilation with the following diagnostic:
Code:
C:Program FilesMicrosoft Visual StudioMyProjectsprintwinPrintWin.f90(1272) : Severe: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report.  Note: Fil
e and line given may not be explicit cause of this error.
character(LenTrimAll(String)) :: TrimAll   ! Function type - its length
----------^
C:Program FilesMicrosoft Visual StudioMyProjectsprintwinTestSVO.f90
Error executing df.exe.
Any thoughts on a work around?
P.S. I amusing CVF 6.6C

Message Edited by ANTHONYRICHARDS on 04-27-2005 03:02 PM

0 Kudos
edr
Beginner
2,385 Views
Anthony:
Alan sent me the message below to post based on your last post....If you can't get past the compiler error let me know and I'll see if I can find the version I'm using with Win98....I know it will compile and run on CVF 6.6C3...It may be the weekend before I can find time to get it.....It's the last week of classes and I'm up to my ears in making up final exams, etc....
Ed. Raney
P.S. If we can get you a version that will work it is well worth it....The routine does a fine job of printing graphics....I have it imbedded in a very large finite element code and use it to capture and print results plots.,.....
Anthony,

I have found that all flavours of CVF 6.6C (and I was up to CVF6.6C3 in the end) gave a number of Internal Compiler Errors with a variety of my programs. In some cases I was able to eliminate them by merely reversing the order in which routines were listed in the source code. Others I could not hack. So I retreated to CVF6.6B, where I get no such trouble.

There is a posting "Any hope for CVF internal compiler error?" that throws some light upon the subject, but I am not going to try CVF6.6C again until I finish my current contract towards the end of the year.

In the mean time, perhaps you might try looking at fixes, maybe based on the public or private declarations in the prwin module. Interestingly, this is the first such error in a program of under 3,000 lines of source code, which previously inhibited me from asking support@compaq.com for advice.

Regards

Alan
0 Kudos
edr
Beginner
2,385 Views
Anthony:
After looking closer at your post it appears that your compiler error is in the Test module.....Does the basic PrintWin and associated subroutines compile OK???? If so you may still be in business as you don't need the test module to include the routines in other source code....
Ed.R.
0 Kudos
david_jones
Beginner
2,385 Views
I get the same internal compiler error with 6.6C3. The .doc file specifically mentions 6.6B and excludes the later versions because of the compiler error. I haven't been able to find a quick fix.
In case it helps you make immediate progress, I am attaching a more complete .zip file of an earlier version of the code (but later than my inital posting, as I can't find the corresponding missing files).
0 Kudos
anthonyrichards
New Contributor III
2,385 Views
Thanks for the reply. I got the program (extracted from PrintWIn141.zip) to compile and run OK with CVF 6.6Cby just swapping the order of the code for TrimAll and LenTrimAll, that is I put
the code for Function TrimAll before the code for Function LenTrimAll.
P.S. When run, the PrintWin Printset-up dialog does not show names of printers installed from a network...e.g. only the bottom 4 printers show up in the PrintWin Print set-up dialog shown in the attachedpicture. The 'standard' print dialog shows them all. Is this a result of character-filtering in the PrintWin program?
0 Kudos
david_jones
Beginner
2,385 Views
I have made the swap suggested and the code now works for me too.
The missing printer-names are mysterious. I did think that the code may have reverted to working only for printer-names less than 32 characters as in an original version (due to using specific APIs for Windows), but this new version does work for my network printers where the names are longer than 32 and longer than some of yours which are missing from the list displayed. The program seems to have an upper limit of 80 characters and you might try changing that (by editing the character*80 declarations). However there may be something more fundamental going on. A problem for Alan is that he doesn't/didn't have a network-based situation in which to test things out. I think the problem may arise in recognising the valid part of the printer name in the string returned by the API routine.

Message Edited by David_Jones on 04-29-2005 01:04 PM

Message Edited by David_Jones on 04-29-2005 01:05 PM

0 Kudos
david_jones
Beginner
2,385 Views
Alan Cruttenden has asked me to post the message below. Before that I should make clear that when I said that longer network printer names work for me, this was for version 1.41 with Windows 2000. Also, sorry for the delay with this, due to the UK Bank Holday.
Message copied in...

This CVF6.6B & C business is infuriating - especially because 6.6C will never be fixed. Swapping the order of subroutines round may work for PrintWin and its associated routines in the source code that I had posted for me, but when TrimAll & LenTrimAll are just two of many routines in a rather long utilities file, I assure you that it is hair-tearing time. If anyone knows of a good reason why my original source code did not compile with CVF6.6C, please let me know.

Anthony Richards, I suggest that you run under debug, putting a breakpoint at line 357 of PrintWin:

i = lstrcmpi(EPrinterName, LprinterName) ! Compare strings.

Examine EPrinterName (put prwin::EPrinterName as the Name in the Debug box) and also nPr (prwin::nPr). If the number of printers and their names are incorrect at this point, then my use of EnumPrinters is faulty. If they are both correct, then follow on through until the bug occurs. If you would like to correspond with me directly, especially because I currently cannot post anything on the Forum, Email to alan.cruttenden@lineone.net. If we can crack your problem together, I will get you to post the next version on the Forum.

Alan Cruttenden

0 Kudos
Reply