Qt Assistant: how to enlarge the help window when QT-Assistent starts as a process

QT4.8

Hi, I am connecting to QT-Assistent using the QProcess scheme.

For example (from a QT document)

QProcess *process = new QProcess; QStringList args; args << QLatin1String("-collectionFile") << QLatin1String("mycollection.qhc") << QLatin1String("-enableRemoteControl"); process->start(QLatin1String("assistant"), args); if (!process->waitForStarted()) return; 

and I pass commands to him using the suggested documentation:

  QByteArray ba; ba.append("setSource qthelp://com.mycompany.1_0_0/doc/index.html\n"); process->write(ba); 

My problem:

How to enlarge the help window if the user minimizes it? Because help works like another process, no way was found to bring the window up.

TIA.

0
source share
1 answer

If you are starting another process, then you need to use special OS management tools for Windows.

You can often get the window identifier when creating a process, but the control of its window depends on the platform.

Qt has not left its scope for full access to the shell on different platforms, but here's how you do it on Windows:

http://qt-project.org/doc/qt-5/qprocess.html#processId

http://forums.codeguru.com/showthread.php?353149-How-to-Get-windows-Handle-using-Process-Id

fooobar.com/questions/22754 / ...

http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548(v=vs.85).aspx

 #include <windows.h> //... HWND h = ::GetTopWindow(0 ); { DWORD pid; DWORD dwTheardId = ::GetWindowThreadProcessId( h,&pid); if ( pid == process->processId() ) { // here h is the handle to the window break; } h = ::GetNextWindow( h , GW_HWNDNEXT); } ::SetForegroundWindow(h); ::ShowWindow(h, SW_SHOWMAXIMIZED); 

Hope this helps.

+1
source

Source: https://habr.com/ru/post/1207154/


All Articles