473,395 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Screen flash when using cl.exe

I'm using an application (a Tcl/Tk app) that uses cl.exe to compile code in the
background. One very annoying feature is that a DOS box is flashed to the
screen and then withdrawn during linking. Imagine using this application to
link thousands of executables and trying to use the machine while thousands of
temporary DOS boxes appear and temporarily take focus away from the application
you are using.

The only other time that I have seen this is with using Intel's Fortran
f90com.exe compiler (see Issue 185355). Intel is aware of the bug and maybe the
same bug exists with Microsoft's cl.exe compiler.

Here's the discussion of the issue with Intel Support. Maybe you Microsoft
developers can implement this change in the code for Visual C++ as well?

---- BEGIN ISSUE DETAILS WITH INTEL ----

In talking with Mr Lionel, I learned that your code uses _spawnvp to invoke
f90com.exe. I request that it be replaced with CreateProcess. Here's a detailed
response that I gave Steve:

I've been able to create a stand-alone use case. An individual on the
comp.lang.tcl newsgroup was kind enough to provide the explanation (which may I
note appears in other applications which start without a console):

--- BEGIN EXPLANATION ---

When Windows starts a subprocess, it will try and attach it to a console unless
the CreateProcess() call specifies that the child is "detached". Windows
attaches the new process to the parent's console, if it has one; otherwise it
creates a new console window for the child.

Wish (the interpreter for Tk) starts subprocesses as "detached" children, which
means that they do not have a console. If the child (make, in your example) then
starts another process but doesn't provide the detached flag, Windows will
create a console for this grandchild process. The implementation of _spawnXX()
in Microsoft's libraries does not normally provide the detached flag.

--- END EXPLANATION ---

To exercise this explanation, I wrote two applications. The 1st use case had the
first application launch the second application using _spawnXX using a WISH. The
behavior I see with "ifl" launching "f90com" was reproduced. Then I modified the
first application to use CreateProcess instead. Since Windows was going to
create the console regardless, I set a flag (SW_HIDE) in CreateProcess to not
show the window.

How would I go about requesting for Intel to create an optional command-line for
"ifl" (say /suppressSubconsoleWindowCreation) which would use CreateProcess
(similar to the code below) instead of _spawnvp when launching f90com?

Here's my code for launching the application via CreateProcess instead of
_spawnvp. Note that stdout, stdin, and stderr are inherited from the parent.

char command[] = "f90com.exe";

STARTUPINFO si;
PROCESS_INFORMATION pi;

ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
si.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
si.wShowWindow = SW_HIDE;

ZeroMemory(&pi, sizeof(pi));

// New process inherits handles from the calling process
if (!CreateProcess(NULL, command, NULL, NULL,
TRUE,
NULL, NULL, NULL,
&si, &pi)) {
//
// Big bad error
//
} else {
WaitForSingleObject(pi.hProcess, INFINITE);
}

CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);

Nov 17 '05 #1
2 2080
PS This problem exists with the Visual C++ .NET 2003 compiler.
Owen wrote:
I'm using an application (a Tcl/Tk app) that uses cl.exe to compile code
in the background. One very annoying feature is that a DOS box is
flashed to the screen and then withdrawn during linking. Imagine using
this application to link thousands of executables and trying to use the
machine while thousands of temporary DOS boxes appear and temporarily
take focus away from the application you are using.

The only other time that I have seen this is with using Intel's Fortran
f90com.exe compiler (see Issue 185355). Intel is aware of the bug and
maybe the same bug exists with Microsoft's cl.exe compiler.

Here's the discussion of the issue with Intel Support. Maybe you
Microsoft developers can implement this change in the code for Visual
C++ as well?

---- BEGIN ISSUE DETAILS WITH INTEL ----

In talking with Mr Lionel, I learned that your code uses _spawnvp to
invoke f90com.exe. I request that it be replaced with CreateProcess.
Here's a detailed response that I gave Steve:

I've been able to create a stand-alone use case. An individual on the
comp.lang.tcl newsgroup was kind enough to provide the explanation
(which may I note appears in other applications which start without a
console):

--- BEGIN EXPLANATION ---

When Windows starts a subprocess, it will try and attach it to a console
unless the CreateProcess() call specifies that the child is "detached".
Windows attaches the new process to the parent's console, if it has one;
otherwise it creates a new console window for the child.

Wish (the interpreter for Tk) starts subprocesses as "detached"
children, which means that they do not have a console. If the child
(make, in your example) then starts another process but doesn't provide
the detached flag, Windows will create a console for this grandchild
process. The implementation of _spawnXX() in Microsoft's libraries does
not normally provide the detached flag.

--- END EXPLANATION ---

To exercise this explanation, I wrote two applications. The 1st use case
had the first application launch the second application using _spawnXX
using a WISH. The behavior I see with "ifl" launching "f90com" was
reproduced. Then I modified the first application to use CreateProcess
instead. Since Windows was going to create the console regardless, I set
a flag (SW_HIDE) in CreateProcess to not show the window.

How would I go about requesting for Intel to create an optional
command-line for "ifl" (say /suppressSubconsoleWindowCreation) which
would use CreateProcess (similar to the code below) instead of _spawnvp
when launching f90com?

Here's my code for launching the application via CreateProcess instead
of _spawnvp. Note that stdout, stdin, and stderr are inherited from the
parent.

char command[] = "f90com.exe";

STARTUPINFO si;
PROCESS_INFORMATION pi;

ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
si.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
si.wShowWindow = SW_HIDE;

ZeroMemory(&pi, sizeof(pi));

// New process inherits handles from the calling process
if (!CreateProcess(NULL, command, NULL, NULL,
TRUE,
NULL, NULL, NULL,
&si, &pi)) {
//
// Big bad error
//
} else {
WaitForSingleObject(pi.hProcess, INFINITE);
}

CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);


Nov 17 '05 #2
Owen wrote:
PS This problem exists with the Visual C++ .NET 2003 compiler.


If the problem is that you don't like how cl.exe invokes link.exe, why not
just invoke the linker yourself, using CreateProccess as you're suggesting?

-cd
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ben Baker | last post by:
Hi, Is it possible to use javascript to detect if a screen reader is running a on a users machine? I know that on a pc, screen readers use the MSSA interface. Is there a way to detect...
64
by: Dave | last post by:
A friend of mine pointed out the other day that certain elements on my web site are too small. But in most of what I publish, fonts are at default size or smaller, and my images are easy to see. I...
2
by: Tom | last post by:
Hi all In winform application I am trying to start 2 forms I am trying to show the 2nd winform on a separate thread. using Thread mainapp = new Thread(new ThreadStart(loadmainscm)); ...
3
by: UJ | last post by:
My client wants to have some text scale appropriately depending on the resolution of the screen. This is very much like the way that flash works in that as the area being displayed gets bigger, the...
2
by: Rehan Shaikh via .NET 247 | last post by:
i've created a flash screen form with the follw. code; dim obj as new form2() private sub form1_load( By val sender..... me.timer1.start() obj.showdialog() end sub private sub timer1_tick (By...
25
by: OziRus | last post by:
Hi, This is my first message on this group. I want to ask something about screen-drawing functions. I wrote and compiled below code succesfully on TC IDE in Win-xp. Then i tried to work it on...
2
by: dumbledad | last post by:
Hi All, I'm using ASP.Net web services to provide the logic required for a Flash based prototype. The Flash and the ASP .Net run together on the client machine. One of the functions I'd like to...
4
by: Mark Siler | last post by:
First let me say I'm not a developer. I'm looking for someone that can either do this for me or point me to a technology that can. I'm in need of a way via the Internet to push a screen or webpage...
0
by: vinayakk | last post by:
Hello webies, I have a problem with loading html pages in frameset. I am using location.href to load html pages one by one upon the user request and these pages in turn load flash files. When one...
3
by: Bernard.Mangay | last post by:
At the bottom of a windows screen are those rectangular boxes for each application. Sometimes they flash to alert the user that somethign has happened. How can I make my own C Sharp applications...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.