At first, the Windows explorer.exe was closed and the desktop screen went black. My program needs to start explorer.exe. This is I tried:
QProcess process;
process.execute("explorer.exe");
The problem is this only pops up a new explorer window instead of reactivating the desktop explorer (turn the black screen back to desktop). It should behave just like when you run explorer.exe after you kill it in cmd or powershell.
Solution found:
QProcess::startDetached("explorer.exe"); //Wrong
QProcess::execute("C:\\Windows\\explorer.exe"); //Wrong
QProcess::startDetached("C:\\Windows\\explorer.exe"); //Right
If anyone knows why explorer.exe behaviour like this, please share it.
Related
I re-compiled the Tor Browser on Windows with minGW, and after I launch Tor, the console window opens too- he shows me all the details from the begging of launching Tor.
There is a way to hide this console window?
by the way i did the same thing in Linux with Terminal and it did not open the console window.
The way that you can hide the console window is to add to your "main" file this line
ShowWindow(GetConsoleWindow(), SW_HIDE);
and re-compile again.
it will open your tor.exe console window for less then 1 second, and will close him self automatically.
if any one else knows how to completely avoid the opening of the console window ill be glad to hear the way to do that.
Is there a command on the Windows terminal to close the window of an active application without actually killing the task/process?
What I'm looking for is something similar to clicking the 'X' button on the application window's name bar, or hitting Alt+F4 on it.
Any help would be greatly appreciated. Thanks!
I don't want the taskkill command because it terminates the process. I don't want it to terminate, say I want to close a Skype window so that it pops up in my Notification Tray on my Taskbar.
I couldn't find a specific command on the Windows terminal to do what I wanted, but I found this VBScript code online that did the trick for me.
set shell = createobject("wscript.shell")
shell.appactivate("Skype for Business")
shell.sendkeys "%{F4}"
This simulated an Alt+F4 keypress to Skype, which effectively closed the window and sent it to my Notification Tray.
In linux terminal as I give ctrl+L signal, terminal screen clears. since I am new in windows programming and I found that cls command is used to clear screen. How can I make ctrl+L signal in case of windows cmd to clear screen.
You should use the cls command as a key shortcut will be more difficult.
There is something called AutoHotkey, you can try that and tell us if that helped you :)
Click here to go to their website: AutoHotkey
I am trying to write a program what will manage few console windows, my program will be able to CreateProcess() for new console windows, get a window main handle and the use that handle to resize, close, hide, change title etc. But I cannot find a reliable way to get a main window handle. The purpose is to have a tab bar and switch between created console windows with the click on the tab.
I have tried few ways:
1) use windows "cmd.exe" ability to set window title, and then FindWindow("tmp_title"...)
This has a problem, I do not need cmd.exe running, and also I need a processID for the target program not the cmd.exe. Maybe I should use this way but check for children subprocesses?
2) EnumWindows() then CreateProcess() then wait 40 ms, then EnumWindows() again and find the new window.
This is unreliable! I got two new windows sometimes for weird reasons.
3) use GetWindowThreadProcessId() + EnumWindows(). This worked the best on XP, but on win7 the found window seems to be the wrong one, it's GetWindowText() returns "DefaultIME" and hide/show of this window does nothing. So it is obviously a wrong one.
So any idea how to do it reliably and if possible cross-platform (Cross-windows, XP,Vista,7)
How would you minimize a running windows service using batch file or cmd lets say firefox.exe to start up and run minimized or minimized to system tray?
You call start /min firefox it will start minimized. However theres a caveat dont do this with Firefox window open because then it will not do this, unless you start a new session. There is no way for batch to start things in the system tray unless the software itself has switches for this. But then that's not a batch issue