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

Write to console opens a new console instead of writing to console I allocated.

Zernow__Richard
Neuer Beitragender I
848Aufrufe

Fortran Compiler Intel Parallel Professional.  VS 2019.

I inherited this rather old application which uses dflogm to present a simple GUI for the user.  When the user hits the RUN button in the GUI there are several diagnostic and informative outputs going to the console.

The first statement to the console is a simple statement like write(*,*) 'In MyApp'

The problem is, upon hitting the RUN button a full screen console window opens behind the GUI that occupies the ENTIRE screen.  No sizing options, no taskbar is visible, etc.  Displayed in that window are the words        In MyApp.

I added the following lines with the idea of opening a small console window which I thought would capture all the output instead.

 

USE IFWIN

logical :: status

status = AllocConsole()

write(*,*) 'In MyApp'

 

When I step through the status line a small console window opens as I thought it would.

Stepping through the next write statement still opens the full screen window as before, albeit behind the small console window, and the words    MyApp    appear there.

I know there is something simple I am missing.  I have been all over the Google world and have not found a solution to my problem.  Any help would be appreciated.

 

Thank you.

 

Richard

0 Kudos
1 Lösung
Zernow__Richard
Neuer Beitragender I
744Aufrufe

Steve,

Ultimately I want to not have another console window open.  But now that I understand from your description above how a program can open another window I will walk through the program to find out where the code is opening an additional window.

Again, thank you for your help and will mark this thread as resolved.

Very Respectfully,

Richard

Lösung in ursprünglichem Beitrag anzeigen

8 Antworten
Steve_Lionel
Geehrter Beitragender III
826Aufrufe

It sounds as if the application was built as a "Standard Graphics" application, a variant of QuickWin that was meant to imitate a DOS application. If so, AllocConsole won't do anything useful for you. 

I have several ideas of what you can do about it but need more information.  Please attach the .vfproj file from the project to a reply here - that will help us understand a bit better what may be happening.

Zernow__Richard
Neuer Beitragender I
789Aufrufe

Steve,

Sorry for the delay.  Life sometimes gets in the way of having one.

 

I tried to attach my .vfproj file but the system rejected the attachment so I am simply copying it here.  I have my project set up for both 64 bit and 32-bit in both DEBUG and RELEASE mode.

 

Thank you for helping.

 

Sincerely,

 

Richard

 

<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject ProjectCreator="Intel Fortran" Keyword="QuickWin StdGraphics" Version="11.0" ProjectIdGuid="{FC62F620-40A2-4AAD-9C0A-6EBB048B0330}">
<Platforms>
<Platform Name="Win32"/>
<Platform Name="x64"/></Platforms>
<Configurations>
<Configuration Name="Debug|Win32" OutputDirectory="C:\Users\rzernow\Documents\BLASTO\DEV\Version_Legacy_2\BLASTO_Legacy\Executable_Files" IntermediateDirectory="C:\Users\rzernow\Documents\BLASTO\DEV\Version_Legacy_2\BLASTO_Legacy\Source_Code\Debug32" TargetName="BLST2-32">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" WarnInterfaces="true" Traceback="true" BoundsCheck="true" StackFrameCheck="true" RuntimeLibrary="rtStandardGraphicsDebug"/>
<Tool Name="VFLinkerTool" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" GenerateManifest="false" GenerateDebugInformation="true" SubSystem="subSystemWindows"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Debug|x64" OutputDirectory="C:\Users\rzernow\Documents\BLASTO\DEV\Version_Legacy_2\BLASTO_Legacy\Executable_Files" IntermediateDirectory="C:\Users\rzernow\Documents\BLASTO\DEV\Version_Legacy_2\BLASTO_Legacy\Source_Code\Debug" TargetName="BLST2-64">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" Traceback="true" BoundsCheck="true" StackFrameCheck="true" RuntimeLibrary="rtStandardGraphicsDebug"/>
<Tool Name="VFLinkerTool" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" GenerateManifest="false" GenerateDebugInformation="true" SubSystem="subSystemWindows"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release|Win32" OutputDirectory="C:\Users\rzernow\Documents\BLASTO\DEV\Version_Legacy_2\BLASTO_Legacy\Executable_Files" IntermediateDirectory="C:\Users\rzernow\Documents\BLASTO\DEV\Version_Legacy_2\BLASTO_Legacy\Source_Code\Release32" TargetName="BLST2-32">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" RuntimeLibrary="rtStandardGraphics"/>
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" GenerateManifest="false" SubSystem="subSystemWindows"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release|x64" OutputDirectory="C:\Users\rzernow\Documents\BLASTO\DEV\Version_Legacy_2\BLASTO_Legacy\Executable_Files" IntermediateDirectory="C:\Users\rzernow\Documents\BLASTO\DEV\Version_Legacy_2\BLASTO_Legacy\Source_Code\Release" TargetName="BLST2-64">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" RuntimeLibrary="rtStandardGraphics"/>
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" GenerateManifest="false" SubSystem="subSystemWindows"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration></Configurations>
<Files>
<Filter Name="Header Files" Filter="fi;fd;h;inc">
<File RelativePath="..\..\Source_Code\resource.h"/></Filter>
<Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File RelativePath="..\..\Source_Code\FAB6.rc"/></Filter>
<Filter Name="Source Files" Filter="f90;for;f;fpp;ftn;def;odl;idl">
<File RelativePath="..\..\Source_Code\BLASTOmk1.f90"/>
<File RelativePath="..\..\Source_Code\commons.fab"/>
<File RelativePath="..\..\Source_Code\fab5.7.f"/>
<File RelativePath="..\..\Source_Code\input.var"/>
<File RelativePath="..\..\Source_Code\resource.fd"/>
<File RelativePath="..\..\Source_Code\resource.hm"/></Filter></Files>
<Globals/></VisualStudioProject>

Steve_Lionel
Geehrter Beitragender III
781Aufrufe

My guess was correct - this is a QuickWin Standard Graphics project, which may not be what you want. You can read more about QuickWin at Using QuickWin (intel.com)

It's likely that the application does need to be QuickWin, but it can be the "regular" QuickWin that has a multiple document interface and a toolbar. You would not use AllocConsole here - output to Fortran's "standard output" units will go to one of the QuickWin windows.

Zernow__Richard
Neuer Beitragender I
759Aufrufe

Steve,

Thank you for your reply.  I was actually in the middle of rebuilding as a regular QuickWin project to see what would happen when I received your response.

As of today, the full screen black console window is gone.  It was replaced by an immovable smaller gray window with a smaller black console inside of it that is currently receiving diagnostic statements being sent by the code.  Additionally, a movable black console window appears.  I have attached a screen capture here called "Capture New Code.jpg".

I suspect the code is issuing some kind of DOS command that may be causing the other window to appear because at one point it was reporting a folder already existed.  When I looked at the code I found a command ( EXECUTE_COMMAND_LINE) to make a directory and there was no check on the pre-existence of the folder.  I fixed that.  The window appears prior to that.  Anyway, I'm sure I can track that down.

A very old version of the code (one for which I have no source code or project files) only generated a single small console window which was moveable and sizeable and received all diagnostic messages. I have also attached a screen capture of that program called "Capture Old Code.jpg".

I have also included what I think is the relevant part of my new vfproj file for you to see.  

If you have any more ideas I would greatly appreciate them.  Your help has always been appreciated.  You were a life saver on a problem I had a while ago wrt linked lists in Fortran.

Very respectfully,

Richard

 

<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject ProjectCreator="Intel Fortran" Keyword="QuickWin" Version="11.0" ProjectIdGuid="{081C88C6-CD93-4262-969B-732D0E578753}">
<Platforms>
<Platform Name="Win32"/>
<Platform Name="x64"/></Platforms>
<Configurations>
<Configuration Name="Debug|Win32" OutputDirectory="C:\Users\rzernow\Documents\BLASTO\DEV\Version_Legacy_2a\BLASTO_Legacy\Executable_Files" IntermediateDirectory="C:\Users\rzernow\Documents\BLASTO\DEV\Version_Legacy_2a\BLASTO_Legacy\Source_Code\debug32" TargetName="BLST2a-32">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" WarnInterfaces="true" Traceback="true" BoundsCheck="true" StackFrameCheck="true" RuntimeLibrary="rtQuickWinDebug"/>
<Tool Name="VFLinkerTool" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" GenerateManifest="false" GenerateDebugInformation="true" SubSystem="subSystemWindows"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>

Steve_Lionel
Geehrter Beitragender III
751Aufrufe

What you show in the "New" is a normal QuickWin interface. By default you'll get one black window where "console" output goes. A program can open additional windows as described in the document I linked above. These are scrollable, you can copy from them and move them around. (The program can also change various attributes.)

What do you want to happen?

Zernow__Richard
Neuer Beitragender I
745Aufrufe

Steve,

Ultimately I want to not have another console window open.  But now that I understand from your description above how a program can open another window I will walk through the program to find out where the code is opening an additional window.

Again, thank you for your help and will mark this thread as resolved.

Very Respectfully,

Richard

Steve_Lionel
Geehrter Beitragender III
726Aufrufe

Look for OPEN statements with the specifier FILE='USER'.

Zernow__Richard
Neuer Beitragender I
720Aufrufe

Steve,

Thank you, I'll do that. 

Richard

Antworten