Silverfrost Forums

Welcome to our forums

Vista and Printing

8 Jul 2008 1:39 #3442

I am checking out Vista with programs which have worked fine for a couple of years and more on XP. Most things are fine but I wondered if others had come across the following. [I must admit at the outset that I do not have a very recent version of the compiler]:

If I have a program 'A' to output results which just uses open_printer@ and close_printer@ and does NOT itself have any screen / buttons of its own then all works fine.

However if I have a program 'B' which has its own screen and buttons - say Print and Continue - and has the printing routines as a subroutine within it (open_printer / close_printer etc), then whilst the printing itself works fine (to local or network printer), and subsequent actions by the user (e.g. selecting Continue after Print which then writes to file and closes the open window) are acted on correctly, the program itself fails to close completely and remains sitting in Process Manager. IF the PRINT button is NOT used before selecting Continue, everything closes as expected!???

Any suggestions on cause, or how the rogue window might be closed (other than manually!) would be appreciated.

Many Thanks

Bill

9 Jul 2008 8:03 #3443

I should add that in 'desperation', and assuming this was a problem with my old version of Fortran, I have downloaded the latest personal FTN95 to a new Vista machine and get the same problem with several (fairly large) programs.

Thanks, Bill 😦

9 Jul 2008 12:51 #3444

Sample code for this problem below: c c TASK2.FOR - to test Process Closure on Exit after Printing c In VISTA leaves process still running if print actioned c first and Exit afterwards. c FTN95 TASK2.FOR /LINK c winapp OPTIONS(INTL) OPTIONS(LOGL) implicit none INCLUDE <WINDOWS.INS> c external exit_func external iprint

  integer*4 ii

  ii=winio@('%ww[no_border,maximise]&amp;')
  ii=winio@('%ff%nlPrint then Exit - Process is still there !&amp;')
  ii=winio@('   %^11bt[&amp;Print]&amp;','gprinter_open',iprint)
  ii=winio@('   %`^11bt[&amp;Exit?]',exit_func)

  end

c integer4 function iprint() implicit none INCLUDE <WINDOWS.INS> integer4 poclose call set_text_attribute@(1L,10.0,0.0,0.0) call draw_characters@('printer text',100L,100L,rgb@(0L,0L,0L)) poclose = close_printer@(0) iprint = 0L end c c -------------------------------------- c Function for 'EXIT' c integer*4 function exit_func() implicit none INCLUDE <WINDOWS.INS> c open(12,file='testit') write(12,99000) 99000 format('Exit Key Pressed') close(12) exit_func = 0L end c

20 Jul 2008 2:19 #3494

I am still experiencing this problem with Vista.

However in looking back at the code posted above the iprint function was set = 0L at the end and not 1L as intended. Selecting Print first (which then returns to allow a further button selection to be made), and then Exit following this does, on Vista, leave the process still sitting in process manager.

Thanks, Bill

20 Jul 2008 7:50 #3496

Bill,

I suspect that many Fortran folk have not gone for Vista, as it appears to consume more resources than XP. Not only that, but some of the 'look and feel' aspects of Vista appear to be rather difficult to emulate with Clearwin+

You may well be a pioneer, and I for one look forward to reading the details.

Eddie

20 Jul 2008 8:50 #3498

Aside from the above 'bug???' - feedback would be welcome please ...

I am pleased to say that I have moved some 50,000 lines of FTN95 (or really FTN77) / and lots of old Clearwin+ code smoothly (aside from some old weak programming from me) over to Vista very easily. I was (up until a month ago) rather -ve about Vista but on a fast (Dual) processor with lots of memory code runs very quickly. To fully emulate Vista 'style' may be difficult in Clearwin but using the Aero Vista basis makes a nice smooth transition between screens. I too would not have bothered to move towards Vista (why complicate what works well already!) but as I produce code for business who will, in a year or two, probably move that way, getting to grips with it early is desirable.

20 Jul 2008 10:50 #3499

HI,

I've had a problem with printing, but not in Vista. As soon as I saw that you were calling set_text_attribute@, then I realised that could be your problem. It does not now seem to be documented in FTN95, and has been replaced by separate routines.

Try select_font@, scale_font@, rotate_font@, italic_font@

where real4 parameters are now real8 and integer2 now integer4

Regards

Ian

Old definition was SUBROUTINE SET_TEXT_ATTRIBUTE@(FONT,SIZE,ROTATION,ITALIC) INTEGER2 FONT REAL4 SIZE,ITALIC,ROTATION

21 Jul 2008 6:32 #3500

Dear Ian,

Many thanks for pointing this out - something to be noted - BUT unfortunately even if you either (a) cut out the statement completely and use defaults and/or (b) bring up the printer dialogue box and Cancel it without printing then in both instances when Exit is selected the process remains in Process Manager!

Thanks again

Bill

21 Jul 2008 6:49 #3501

Well, it was worth a try. I must say, I don't use gprinter_open@, rather I use open_printer@ or open_printer1@ your example would look like:

c 
c TASK2.FOR - to test Process Closure on Exit after Printing 
c In VISTA leaves process still running if print actioned 
c first and Exit afterwards. 
c FTN95 TASK2.FOR /LINK 
c 
winapp 
OPTIONS(INTL) 
OPTIONS(LOGL) 
implicit none 
INCLUDE <WINDOWS.INS> 
c 
external exit_func 
external iprint 

integer*4 ii 

ii=winio@('%ww[no_border,maximise]&') 
ii=winio@('%ff%nlPrint then Exit - Process is still there !&') 
ii=winio@(' %^11bt[&Print]&',iprint) 
ii=winio@(' %`^11bt[&Exit?]',exit_func) 

end 
c 
integer*4 function iprint() 
implicit none 
INCLUDE <WINDOWS.INS> 
integer*4 poclose,i
i=open_printer@(1)  !handle changed to 1 just for fun
if(i .eq. 1)then
  i=SELECT_GRAPHICS_OBJECT@(1)  !added just in case
  call set_text_attribute@(1L,10.0,0.0,0.0) 
  call draw_characters@('printer text',100L,100L,rgb@(0L,0L,0L)) 
  poclose = close_printer@(1)
!force closure on return
  iprint = 0L
else
! remain open, as no printer selected
  iprint = 2L
endif 

end 
c 
c -------------------------------------- 
c Function for 'EXIT' 
c 
integer*4 function exit_func() 
implicit none 
INCLUDE <WINDOWS.INS> 
c 
open(12,file='testit') 
write(12,99000) 
99000 format('Exit Key Pressed') 
close(12) 
exit_func = 0L 
end 
c

Regards

Ian

21 Jul 2008 8:44 #3505

Dear Ian,

Thanks for your code example - exactly the same result I'm afraid. I just made one change to the code you posted -

When the Window with 'Print' and 'Exit' is put up I do NOT Exit until Exit is pressed (note comment in a previous post about fault in my original hastily posted code) - thus:

!DO NOT force closure on return after printing iprint = 1L else

Once again Print first followed by Exit closes window but leaves job in Process Manager.!!

I am currently resorting to using 'terminate process' to kill off the remains!!

Thanks again

Bill

28 Jul 2008 2:11 #3602

The problem of a job which has produced printed output then remaining in process manager after closing all its windows still persists. However extensive tests have shown that it must be related to the way Vista deals with the closing of network shared printers - locally attached printers using the same drivers work fine and processes go as expected. Vista seems to need something more than close_printer@!!

I am currently using a call to killjob at the very end - which works - but would be grateful for assistance as to exactly how this should really be called.

  subroutine killjob
  include <windows.ins>
  integer*4 L1
  logical*4 L
  L = terminateprocess(getcurrentprocess(),L1)
  return
  end

Hope this helps somebody (stupid enough to get involved with Vista at this point).

Many Thanks

Bill

30 Sep 2008 1:23 #3861

This problem persists and Paul suggested that after a couple of months I might raise it again providing as simple a set of code as possible (below). Under Vista32 any program which puts up a window and then accesses and closes a network printer (or for example Acrobat) - whilst printing works fine - the .EXE remains active in Process Manager and does not close as expected. This problem does not occur when the printing program simply opens / closes the printer and does not put up a window of its own.

Many Thanks for any ideas...

Bill

  winapp 
  INCLUDE <WINDOWS.INS>

c external iprint integer4 iprint integer4 ii c ii=winio@('%ww[no_border]&') ii=winio@('%ff%nlAfter Print - Process is still there !&') ii=winio@('%^bt[&Print]',iprint) end c integer4 function iprint() INCLUDE <WINDOWS.INS> integer4 poopen,poclose poopen = open_printer@(2L) call set_text_attribute@(1L,10.0,0.0,0.0) call draw_characters@('printer text',100L,100L,rgb@(0L,0L,0L)) poclose = close_printer@(2L) iprint = 0L end

2 Oct 2008 4:06 #3867

I have had a look at this problem but I cannot throw any light on what is happening. The Vista that I have access to is on a virtual workstation and I am having problems connecting to a remote printer. As a result I have not been able to reproduce the problem.

Typically Vista causes problems because of increased security so if a program uses a resource for which it does not have full access rights then you can get unexpected errors.

If there is no visible error message then all that I can suggest is that you have a look at the System Event Viewer to see if any error events have been reported. This is not an easy task but here is an outline of what to do.

From the Start button, select Run and type in 'mmc' for Microsoft Management Console.

In the [Cosole Root], click on File and then Add/Remove Snap-in. Look for Event Viewer in the left hand pane and Add it to the selected snap-ins. Select the Local Computer for events to view.

Back in the Console Root, click on the Event Viewer (Local) node in the left hand pane and expand the Error tab in the right hand pane. Look for recent errors that relate to your application.

Its a long shot but it is all that I can think of.

6 Oct 2008 10:26 #3873

Dear Paul,

Many thanks for looking at this but without the appropriate IT resource I can see that you cannot duplicate things.

I have used MMC to view the Event / Error log but there are no relevant error entries there (as you say a long shot).

I would be VERY happy to perform any further tests you (or others) might suggest - I feel that there is no doubt that others will come across this software bug as Vista (rightly or wrongly) grows in popularity.

Just to mention that when you use the debugger on the code the program terminates normally but when you try to close the debugger the message 'task being debugged could not be shut down' is displayed.

Many thanks

Bill

Please login to reply.