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

Losing Window Focus after printing with Fortran_Winprint.f90

Ken2
Beginner
3,901 Views
I have a program that seems to lose the Window focus after printing using the Fortran_Winprint routines.I am using version 2011.9.300of thecompiler. On my home printer, which is a wireless printer, the input cursor comes back on and accepts input only after the print is complete, but at work on a network printer I never get the cursor back for an input. In my program I am picking a selection from a list of options on the screen, when I pick 6 the print subroutines are called and the printout proceeds and then the list of options are again printed out in the output window.Which seems to say the window is still active. At that point I should be able to input a number for the option wanted next, but it will not take any input from the keyboard. I have to mouse click on the desktop and then click back on the window before it will accept input again. Does any one have any ideas on fixing this? I do not remember having the problem in this same program before this version of the compiler.
0 Kudos
35 Replies
Paul_Curtis
Valued Contributor I
2,456 Views
Rather than rely on some accidental and implicit compiler-related feature, use SetFocus(hwnd) to explicitly restore the focus to your parent window's handle.
0 Kudos
Ken2
Beginner
2,456 Views
Well the cause of the problem is a change or bug in the complier. I have some earlier versions of the compiled program that do not have this problem. I'm not sure which version this change or bug occurred in. I think the good one was from VS2008. I have tried to install version 2011.8.278of the compiler, but in fails with a setup error. I guess I will have to report this problem to IVF support.
0 Kudos
Steven_L_Intel1
Employee
2,456 Views
It's neither a change nor bug in the compiler. The only possible compiler-related issue is if your application is a QuickWin app, but even then I am doubtful. Fortran_Winprint just uses standard Windows common dialog boxes to ask you to select a printer - all matters of focus are handled by Windows.
0 Kudos
Ken2
Beginner
2,456 Views
It is a Quickwin application and it definitely only occurred after the compiler was updated.
0 Kudos
Ken2
Beginner
2,456 Views
I keep a backup of the old projects so I copied the source filethat works correctly, without any changes, into the new project and recompiled and now the recompiled code has the same error. It is definitely the compiler.
0 Kudos
Steven_L_Intel1
Employee
2,456 Views
Can you attach a small program that demonstrates the problem?
0 Kudos
Ken2
Beginner
2,456 Views
I have a small program made from the original file that shows the same error. I will try to attach file, but I'm sure sure how to. I can send if you give me the address. It's a little long to copy here.
0 Kudos
Steven_L_Intel1
Employee
2,456 Views
See instructions link in my signature below. Or you can use Intel Premier Support.
0 Kudos
Ken2
Beginner
2,456 Views
Ok done, the files is there.
0 Kudos
Steven_L_Intel1
Employee
2,456 Views
Which compiler verson gave you the result you prefer? This program does not run - it skips over the open of unit 2 and the setting of NPRINT to 2, causing an error later.
0 Kudos
Ken2
Beginner
2,456 Views
It runs without that error here. I will attach the compiler .sln and .suo filesfor this program. It may be an option that I use.
I do know know which version I started having the focus issue. The one that works was complied 10/19/2010 and I would have been using the latest one for that time.

I have tried to install older versions starting with the last one before 2100.3.900 in order to determine which version the error occurs in. It comes up telling me that I do not need to reinstall the VS2010 files, but then when I continue I get and error telling me to try to run the setup file again and it fails. Should I be trying to load the files without the VS2010 files included? I did not want to have both VS2008 and VS2010 installed.

I would greatly appreciate any help you can provide.

Here is the contents of the .sln file for 2010 version maybe it will help you:

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "Refract", "Refract\Refract.vfproj", "{A7785478-12C3-4BB2-BF59-A374727E7392}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A7785478-12C3-4BB2-BF59-A374727E7392}.Debug|Win32.ActiveCfg = Debug|Win32
{A7785478-12C3-4BB2-BF59-A374727E7392}.Debug|Win32.Build.0 = Debug|Win32
{A7785478-12C3-4BB2-BF59-A374727E7392}.Release|Win32.ActiveCfg = Release|Win32
{A7785478-12C3-4BB2-BF59-A374727E7392}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
0 Kudos
Steven_L_Intel1
Employee
2,456 Views
I need the .vfproj file - thanks.
0 Kudos
Ken2
Beginner
2,456 Views

I have attached the file you were needing. Please let me know if I am missing any other info you need.

0 Kudos
Steven_L_Intel1
Employee
2,456 Views
Thanks for the .vfproj. It told me you had changed the options to add /Qsave, which eliminates the error I saw.

I can now reproduce the problem and will escalate it to the developers.
0 Kudos
Ken2
Beginner
2,456 Views
Thanks for your help. Will you report their finding here? Do you happen to know in which version this first occurred?
0 Kudos
Steven_L_Intel1
Employee
2,456 Views
I have not done the "binary search" yet to see when it happened - 11.1.048 is ok. Oddly, I find that the program runs correctly when run under the debugger! I tried to create a short program that put up a message box in a loop where it also read from the "console" - oddly, this works fine in IVF and hangs in CVF!

Unfortunately, issues like this are very difficult to track down, but we have some experience doing so. Don't expect a quick fix, but if I find a workaround, I will let you know.
0 Kudos
Ken2
Beginner
2,456 Views
I did some checking and version 2011.3.175 works correctly. It seemsversions 2011.5.221 and newer have the error.

Is there a way to install 2100.3.175 without its VS2008 shell and use the VS2010 shell along with 2011.9.300?
0 Kudos
Steven_L_Intel1
Employee
2,456 Views
Yes - just install it. You can select the compiler in Tools > Options > Intel Fortran > Compilers.

I suspect I know what change triggered this - it was to fix another QuickWin keyboard focus issue people were reporting on Windows 7. Looks as if we have more to do here...
0 Kudos
Ken2
Beginner
2,456 Views
Do I need to load the non-shell versions? I am using the VS2010 shell version of 2011.9.300. I have tried the using the shell versions, but they usually fail to install without removing the installed firstversion or install with errors.
0 Kudos
Steven_L_Intel1
Employee
2,384 Views
You should be able to install either - it should skip the shell install. But if you want to try the "no shell" version, that would be fine.
0 Kudos
Reply