Hide command windows on startup
Posted by: Ull (---.xs4all.nl)
Date: August 28, 2020 09:24AM

Hi,

When I launch wampserver, I see a lot of command windows flashing. This takes about 30 to 60 seconds.
I don't like it, because I have to wait until this is over and cannot type that time.

Is there any way to prevent these windows flashing up, since they have no use anyway because the show nothing than a black window for a split second.

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: RiggsFolly (Moderator)
Date: August 28, 2020 09:38AM

Hi,

They are part of the normal startup of WAMPServer. They do have a use!

The fact that they take 30 to 60 seconds is a symptom of a slow PC that they are running on and not WAMPServer itself.

So NO, you cannot stop them from appearing

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: Ull (---.xs4all.nl)
Date: August 28, 2020 10:45AM

I understand they are starting the services by command line, but I mean that all those windows appear (black squares flickering) has not much use. I thought it was possible to hide/minimize those windows, same as you can do when running a batch file.



Edited 4 time(s). Last edit at 08/28/2020 10:49AM by Ull.

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: Otomatic (Moderator)
Date: August 28, 2020 11:19AM

Hi,

> I thought it was possible to hide/minimize those windows,
If you find out how, you will win the grand prize. You can try it yourself, all the Wampserver startup scripts are accessible by everyone.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: Ull (---.xs4all.nl)
Date: August 28, 2020 04:29PM

Thanks.

But I have not idea how to edit the wampmanager.exe file or compile a new one.

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: Otomatic (Moderator)
Date: August 28, 2020 04:43PM

Hi,

> But I have not idea how to edit the wampmanager.exe file or compile a new one.
There is no need to modify wampmanager.exe which is a menu generator (Aestan Tray Menu)
The command windows are only opened by php scripts and, in the first place, by refresh.php, for example by:
$output = `$command`;

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: Ull (---.xs4all.nl)
Date: August 31, 2020 11:25AM

Thanks, never checked the script folder, nice programming. But I think it's not possible. Well, probrably just have to live with it. It's only 6 black flickering windows, than I can continue.

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: uiouio78 (---.fbx.proxad.net)
Date: September 24, 2023 10:20PM

I found a way by pinning a window on front (always on top) then launch wamp then unpin window previously pinned at front. With 2 softwares : autohotkey and a program to pin window at front
-----------------
SendInput, shortcut_to_pin_window_on_top
Run, "C:\wamp64\wampmanager.exe"
Sleep 20000
SendInput, shortcut_to_unpin_window_on_top
Exit
-----------------



Edited 1 time(s). Last edit at 09/24/2023 10:26PM by uiouio78.

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: seaatif (39.40.250.---)
Date: December 26, 2023 05:29PM

Hi,

I am facing the same issue. The flickering of screen does not look normal at all. It looks like someone else is controlling my system.

By reading the answer of @RiggsFolly, I came to know that it's a new normal. I am using Wamp since 2010 and honestly speaking, I cant digest this new normal. There will be solutions out there for it.

I think there will be the possibility to show only one black screen instead of flickering of multiple black screens.

I have also went through the below thread and came to know that there is the possibility to create a hidden terminal/command prompt through C# or C++. Whatever language is being used to compile this wampmanager.exe, an API can be developed in this EXE to provide the assistance to run PHP command scripts.

[stackoverflow.com]

Please go through the above thread and consider the request.

I am also happy to offer my services free of cost if needed to fix this issue or any other support, thank you.

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: Otomatic (Moderator)
Date: December 26, 2023 06:21PM

Hi,

If you've read the whole thread, you'll have realized that the command windows that open and close are due to PHP script commands such as exec(), shell_exec(), passthru() or oblique quotes, for example:
$command = $c_apacheExe.'  -t';
$output = proc_open_output($command);
...
$command = "CMD /D /C powershell [System.Text.Encoding]:: Default";
$output = `$command`;
... 
$commandStr = 'HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet';
$command = 'CMD /D /C reg query '.$commandStr;
exec($command, $output);

If you can figure out how to change all this so that no more command windows open, you've won the grand prize! You're welcome to try it yourself - all PHP scripts are accessible without any protection whatsoever.

As for me, I refuse to spend an inordinate amount of time trying out all the more or less rock'n'roll tricks that have been suggested, which turn simple things into Rube Goldberg machines! (Where I come from, we say "gas factory".)

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons



Edited 1 time(s). Last edit at 12/27/2023 08:40AM by Otomatic.

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: seaatif (39.36.90.---)
Date: December 27, 2023 11:42AM

Hi,

Thank you for your guidance. I have changed the file named wampmanager.tpl in the installation directory.

You need to find the section [StartupAction] in this file and replace that section with the below mentioned code and all the flickering black boxes will not appear at startup.

PS: @Otomatic, please update this code in the upcoming version/release of WampServer, thank you in anticipation.



[StartupAction]
;WAMPSTARTUPACTIONSTART
Action: run; FileName: "{$c_phpExe}"; Parameters: "getStartDate.php"; WorkingDir: "{$c_installDir}/scripts"; Flags: waituntilterminated; ShowCmd: hidden
Action: run; FileName: "{$c_phpExe}"; Parameters: "getInstalledBrowsers.php"; WorkingDir: "{$c_installDir}/scripts"; Flags: waituntilterminated; ShowCmd: hidden
Action: run; FileName: "{$c_phpExe}"; Parameters: "refreshSymlink.php {$c_phpVersion}"; WorkingDir: "{$c_installDir}/scripts"; Flags: waituntilterminated; ShowCmd: hidden
Action: run; FileName: "{$c_phpExe}"; Parameters: "refresh.php";WorkingDir: "{$c_installDir}/scripts"; Flags: waituntilterminated; ShowCmd: hidden
Action: resetservices
Action: readconfig
Action: service; Service: {$c_apacheService}; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
{$SupportMySQL}Action: service; Service: {$c_mysqlService}; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
{$SupportMariaDB}Action: service; Service: {$c_mariadbService}; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
{$RunAtStart}Action: run; FileName: "{$c_navigator}"; Parameters: "{$c_edge}[localhost]{$UrlPort}/"; ShowCmd: normal; Flags: ignoreerrors
;WAMPSTARTUPACTIONEND

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: Otomatic (Moderator)
Date: December 27, 2023 02:16PM

Hi,

seaatif, you've won the grand prize!

How could I have forgotten this "ShowCmd: hidden" parameter, which is actually part of the original Aestan Tray Menu documentation:
Quote

ShowCmd
Value
normal|hidden|maximized|minimized
Description
Most programs open a window on the screen when executed; with this setting, you can control how (and if) that window will be shown.
Example
ShowCmd: maximized

Thank you, thank you!

This will be implemented in update 3.3.4 and, of course, in the next full version.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: seaatif (39.40.250.---)
Date: December 27, 2023 03:10PM

Hi again!

I have also changed {$c_phpCli} to {$c_phpExe} in those parameters. As this binary {$c_phpCli} does not consider ShowCmd: hidden parameter and still shows the black screens.

But I am not sure how it will affect your PHP scripts but everything is still working fine for me at least.

Also consider this change for all Actions in this tpl file please. The whole package will give pretty nice look/effect. Thank you.

PS: I will wait for my Grand Prize as well.



Edited 1 time(s). Last edit at 12/27/2023 03:24PM by seaatif.

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: Otomatic (Moderator)
Date: December 27, 2023 03:27PM

Hi,

> As this binary {$c_phpCli} does not consider ShowCmd: hidden parameter and still shows the black screens.

That's the key to the problem! I've just been to the PHP documentation :

The CLI binary is distributed in the main folder as php.exe on Windows. The CGI version is distributed as php-cgi.exe.
Additionally, a php-win.exe is distributed if PHP is configured using --enable-cli-win32. This does the same as the CLI version, except that it doesn't output anything and thus provides no console.

The Grand Prize is: eternal gratitude and appreciation winking smiley

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Hide command windows on startup
Posted by: seaatif (39.40.250.---)
Date: December 27, 2023 06:41PM

As per my understanding by reading the documentation of PHP,

I think we are pretty much safe to use php.exe except using php-win.exe. The later one looks to be the 32 bit version of the exe doing the same stuff.

In your scripts, I think 90% of the tasks that are being performed can be performed with php.exe and ShowCmd: hidden where we don't need any user interaction or output for the user and where we need user interaction, we can use ShowCmd: normal

I have checked Test Port 80 Tool and it works pretty fine. And this tool is already configured with php.exe

Rest is up to you.

If you need any help from my side, you might better know my Email configured with my account.

Options: ReplyQuote


Sorry, only registered users may post in this forum.