Forum > Windows
Cant hide window from taskbar when executing application created with Lazarus
MaartenJB:
Hi,
I want to launch an application with TProcess made with Lazarus, but it won't let me hide the application. If I do the same with for example mspaint.exe it works fine:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses ..., process; var aProcess: TProcess;begin aProcess := TProcess.Create(nil); try if (CheckBox1.Checked) then aProcess.CommandLine := 'mspaint.exe' // <--- Works else aProcess.CommandLine := 'C:\Temp\project1.exe'; // <--- Doesnt Work ( Vanilla Lazarus application ) aProcess.CurrentDirectory:= ExtractFilePath(aProcess.CommandLine); aProcess.Options := aProcess.Options - [poWaitOnExit]; aProcess.ShowWindow:=swoHIDE; // <--- This should hide the application aProcess.Execute; finally aProcess.Free; end;end;
lucamar:
Since you seem to be in Windows, try with:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- {... etc ...} Exclude(aProcess.Options, poWaitOnExit); {== aProcess.Options - [poWaitOnExit];} Include(aProcess.Options, poNoConsole); aProcess.ShowWindow:=swoHIDE; {... etc ...}
Note, though, that some programs don't like to be run hidden, so they take steps to prevent it in their own initialization. There's nothing you can do about it.
winni:
Hi!
For Windows only there is the property TPROCESS.ShowWindow:
Try the option swoHide.
Winni
lucamar:
--- Quote from: winni on August 16, 2021, 04:54:47 pm ---For Windows only there is the property TPROCESS.ShowWindow:
Try the option swoHide.
--- End quote ---
That was already in the OP's oiginal code. It's in fact what got him baffled: that it works with mspaint.exe but not with (his?) testmon.exe
Just saying ... :-[
winni:
Hi!
What ist testmon.exe?
If it is your own code:
Does it got wsMaximized or fsStayOnTop?
--- Quote from: lucamar on August 16, 2021, 04:58:49 pm ---
That was already in the OP's oiginal code.
--- End quote ---
Sorry. Lack of concentration.
Just looking in the airspace over Afghanistan.
Turkish Airforce just flew in it with an A400M (TUAF580 )
Winni
Navigation
[0] Message Index
[#] Next page