0

We built a dynamic library for Windows in C using Microsoft Visual Studio 2008. This library executes many console programs. When this library is used by a GUI Application, console Windows flash on the screen. We need to avoid these screen flashes.

The following is a sample command line executed by the library:

system("ver 2>nul > OS_version_file");

Is there any method to avoid the screen flashes?

Eryk Sun
  • 33,190
  • 5
  • 92
  • 111
mujtaba
  • 195
  • 2
  • 14
  • Why do you even call `ver` and not `GetVersionEx()`? – cremno Feb 26 '15 at 10:58
  • in addition to ver, we use move,ipconfig /all,diskpart etc commands in our code. Do we have any equivalents for these too. – mujtaba Feb 26 '15 at 11:01
  • The library shouldn't modify the user's console window, if any. The GUI application can open and hide a console via `AllocConsole` and `ShowWindow(GetConsoleWindow(), SW_HIDE)`. Or use the following to avoid even the initial window flash. Use `CreateProcess` with `dwCreationFlags=CREATE_NO_WINDOW` to start cmd.exe, or some other console program that just waits. Then call `AttachConsole`. – Eryk Sun Feb 27 '15 at 05:21

1 Answers1

0

try POSIX popen() (or equivalent in Windows).

Community
  • 1
  • 1
pmg
  • 106,608
  • 13
  • 126
  • 198