I have a code that uses clearwin for for graphics (contour plot) etc. on screen. Text output appears on a white window (windows). When moving it to 64 bit all works (after a few minor changes) except the graphics does not work and the text output appears in a black window (dos box). Bot pieces of code have clearwin64.dll and clearwin64f.dll as references. See https://1drv.ms/f/s!AuTT_gAwgmEIhYgSgFyHwtKCa0SQkg for output of 32 and 64 bit version. Could anyone comment what is going astray here? Thanks, Joost

It is a large complex code of about 50 routines. I posted (see link in start of thread) 2 routines that compose the plot and the 'main' program. The 'Start window' of the Main program works fine. If you wish to see the whole lot, I also posted it in a ZIP file. Plato Project file is in root after unzipping. See if you can do something with this. Cheers, Joost

I disabled now GET_WKEY and DBOS but I have still the same problem . Another observation is that when I start the program the intro screen comes up but in the 64 bit version an additional DOS screen comes up (all this is generated by INTRO.F95). I put example and code of INTRO.F95 in link

After a bit more debugging the problem seems to occur because of a function GET_WKEY1. When this function is called (timstp.f95) the plot (which has been assembled via various routines, appears in the window.

This all works for the 32 bit version

When compile 64 bit, I have to include <DBOS.INS> otherwise I get a link error that GET_WKEY1 is not defined. As per the original post the code than runs ok but the plot does not appear.

I have narrowed down with the debugger that the key routine that puts the plot in the graphic window is TIMSTP.F95 (see https://1drv.ms/f/s!AuTT_gAwgmEIhYgSgFyHwtKCa0SQkg and also below in this post).

The statement 'jk=GET_WKEY1@()-314' in line 82 results in the graphic window showing (1st pass) and being refreshed (next passes). The other routines just prepare bits and pieces of the graphic window.

The statement in line 30 'include <DBOS.INS>' is NOT needed for the proper working 32 bit versions but is needed in the 64 bit version as the linker prompts GET_WKEY1@() as an unknown function. But, by including <DBOS.INS> in the 64 bit version the link error is resolved but the graphics window is not generated. So I suspect that I am missing a 64 bit clearwin library, but I can not work out which/what.

As Paul said in other words, it is a major job to go through anybody else’s code and debug it. What you seem to be doing is plotting something and then expecting the user to press a particular key which triggers a new plot of something else. This strikes me as probably a sensible approach in the program that you are working on, although I wouldn’t do it that way.

The problem is, that it is a halfway house between how we would do things as a console application (i.e. in DOS) and a Windows application. In the Windows application paradigm you wouldn’t ask simply for a keypress but you would do something else like popping up a dialogue box, or expecting the user to select something from a menu, or click command button.

The nearest thing that you can do within a Windows paradigm (if GET_WKEYx doesn’t work) is to attach accelerator keys to your window. You have the choice of using the WINIO@ format codes to do this, or, looking at your program fragment for an idea of your programming style, I suggest that the routines

Code:

ADD_ACCELERATOR@ and REMOVE_ACCELERATOR@

are most likely the best solution for you. You can find details in the online help file FTN95.CHM under the Clearwin+ Library Reference heading.

How to use this is on entry to your graphics routine, add accelerator keys to represent all the user choices of how to replot with modification, and then before exit, remove them all.

The way that you would do this in a ‘traditional’ Windows way is to plot your graphics in a proper Window with a menu bar. One of the menu items might be ‘Plot options’. Dropping that menu bar down might give you a selection such as ‘All options’, which would present the user with a dialog box from which options could be selected, or there may be a set of options each with its own ‘radio button’. It strikes me that this isn’t an option for your program because (and correct me, please, if I’m wrong) that your program isn’t a complete Windows application.

There is a ‘Gotcha’ with the accelerator approach, and that is it needs the windows handle, not the %gr handle!