How to open and minimize external app to system tray in Qt - c++

QProcess can be used to open external program, but it will always open an app to the front of all other windows.
Is there a way to open an external app and then minimize/hide this opened app to the system tray?
QString path = QString("external app path here").replace("/", "\\");
QProcess process;
process.start(path); //open the external app, but it will stay on top of other windows
if (process.isOpen()) {
//then minimize this app to system tray;
}
Is this(open and minimize external app to system tray) achievable using Qt methods?
If Qt has no way to minimize opened external app to system tray. Do I have to use Windows API? Any advice or example code would be appreciated.

This should not be specific to Qt. Perhaps Qt session management could be relevant.
It is a matter of window manager and of desktop environment. Both are provided by (very broadly speaking) your "operating system" and are not tied to one particular process using Qt.
The system tray belongs to the desktop environment. A particular process using Qt has no reason to minimize it. The minimization of the system tray is the business of the desktop environment (not of one particular Qt application). I see no reason why your application would do that (remember that your user could also run other applications, which are even more important to him than yours and which also interact with or require using the system tray).
Of course, Qt provides an API to interact with the window manager and the desktop environment.
PS. On Linux, the convention between a Qt application and the window manager or desktop environment are documented in EWMH and ICCCM. You need to find the equivalent for Windows. I never used Windows so I don't know them. On Linux, one can code a window manager using Qt.

Related

Qt/c++: How to set platform independent application icon?

I am developing my Qt (c++) application on MacBook. However, the application might run in both Windows and Mac Systems.
Is there is a way to set platform independent application icon ?!
Setting application icons is already independent, Windows and OS X require different icon formats: http://doc.qt.io/qt-5/appicon.html
the application might run in both Windows and Mac Systems
Right, but not the same executable (binary), you'll compile two versions, one for Windows and one for Mac. Executable icon could be displayed by the OS (when aplication icon is shown on desktop, task bar...) before the application is actually started. So this icon cannot be set programmatically, it must be set at compilation time. And, you must refer to this post to know how to set the application icon for binaries on each different platform.

embedding .exe applications on a QT form

I wanted to know if its possible to embed other .exe applications on a QT form.
Say i have an app called foo.exe. Now I want to lauch foo.exe through my application. I know I could do that using QProcess::startDetached() however I would like that program to run within my form.Is that possible ?
Believe what you want is a kind of "EMBED", there seems to be something done, but I can direct you to a few ways:
Cygwin
In X Window System we have o "X-Embed"
For Windows exists Cygwin/X (apparently to run "multi-threaded" in "google chrome" uses cygwin).
QT X11 Systems: http://qt-project.org/doc/qt-4.8/qvfb.html
Nice example: http://arstechnica.com/information-technology/2009/03/experimental-process-per-tab-browser-created-with-qt-xembed/ (outdated)
ActiveX
You can create Activex Controls, see example: http://qt-project.org/doc/qt-4.8/activeqt-server.html
In two suggestions that you spent the programs you want to add to your main program should be created by you, in other words, programs that are not compiled with "Cygwin" or is not an "ActiveX" (QT you can add controls ActiveX, such as Internet Explorer or MSExcel).
Believe both examples programs work as "servers" and its main program as a "client", in other words, other processes need not necessarily one graphical interface, I believe the main software is who works the GUI part.
For this reason the programs should be "embedded" created with the purpose of "embedding"
Alternative solution (DotNet and user32.dll)
See article:
http://www.codeproject.com/Articles/9123/Hosting-EXE-Applications-in-a-WinForm-project

Stopping the explorer.exe taskbar from opening when using the windows file explorer on XP

I am creating a shell-replacement for developers, which creates a new windows user, titled "developer" and only when you log into this user, should the shell be launched.
The replacement start menu is replaced with a shell based terminal with great features, the taskbar is replaces with a tree based view for windows, and the process monitor is replaced with a view where you can attach process monitors, debuggers, profiles, and memory leak detectors, etc.
I would like my application replace the regular windows shell. I have however came across a registry key that, on windows 7, works just fine. but on windows XP if I use the regular windows XP file manager the windows XP task bar from explorer.exe launches, even though I changed said registry entry!
Does anybody have any idea what it is I need to do to fully replace the windows shell AND taskbar using windows XP while still retaining use of the windows based file manager?: )
Edit:
Using C++, developing using NetBeans using Qt for my gui library. however, as I do not think this should effect the answer, I figured I would include it either way.
I believe Windows XP does not support per-user shell replacement (not sure, it's been a while since I played with the desktop stuff), but you should be able to set the 'Shell' entry under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon and prevent Explorer from registering itself as the shell when it first runs. This will affect all the users in the machine, of course.

how to add in Visual Studio 2010 WinForm Object to a C++ Console Application Project

I am building a C++ Console Application which makes some OpenGL printing.
The entire thing is done by glut and gl libraries. My new goal is to add some Windows Forms to the project so one could "configure" the 'game' with some textbox and other controls provided by VS before the console appliction starts.
I know that the best solution for the current problem is to add Win32 API, but I don't know how to integrate console application project with win32 API alltogether.
I know that in C# it's done quite easily with the .ShowDialog() command.
Although launching a window from a console application is perfectly doable, that window will not be responsive, because your console application does not have a message queue. (Or rather, it has a message queue, but it is implemented by code that you have no control over.) So, you can open up a window, draw in it, and force it to manually update, but you cannot receive user input in it.
I would suggest that you forget about doing it this way, and you write a little windowed application instead, which prompts for the configuration and then launches the console application passing it the configuration as command-line parameters, or fills-in a configuration file for the console application to read.

Using MPI under VC++ MFC project?

Does any body know how can I use MS_MPI in my VC++ MFC project?
I already have a big MFC project and I only want to use parallel processing in a part of it with MPI.
(I know how to use MPI in a separate code, but I don't know how to integrate it with my VC++ MFC project)
Not sure about MS_MPI, but you wanna look at MPICH2 Windows documentation guide at the url at the bottom.
9.3 MPI apps with GUI
Many users on Windows machines want to build GUI apps that are also MPI
applications. This is completely acceptable as long as the application follows
the rules of MPI. MPI Init must be called before any other MPI function
and it needs to be called soon after each process starts. The processes must
be started with mpiexec but they are not required to be console applications.
The one catch is that MPI applications are hidden from view so any
Windows that a user application brings up will not be able to be seen.
mpiexec has an option to allow the MPI processes on the local machine
to be able to bring up GUIs. Add -localroot to the mpiexec command to
enable this capability. But even with this option, all GUIs from processes
on remote machines will be hidden.
So the only GUI application that MPICH2 cannot handle by default
would be a video-wall type application. But this can be done by running
smpd.exe by hand on each machine instead of installing it as a service. Log
on to each machine and run “smpd.exe -stop” to stop the service and then
run “smpd.exe -d 0” to start up the smpd again. As long as this process is
running you will be able to run applications where every process is allowed
to bring up GUIs.
:
http://www.mcs.anl.gov/research/projects/mpich2/documentation/files/mpich2-1.2.1-windevguide.pdf
It is possible. You use it the same way as any other MPI project.
In general, you can link against any C++ library from an MFC project. MFC is just a set of libraries, and doesn't restrict you from using other C++ libraries.