66508

Qt Assistant: How to maximize help window, when QT-Assistent is started as process

Question:

QT4.8

Hi, I am connecting to QT-Assistent using a QProcess schema.

For example (from the QT doc)

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 am passing commands to it by using the suggested documentation:

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

<strong>My Problem:</strong>

How to maximize the help window, in case user minimizes it? Since the help is running as different process, did not find a way to bring the window up.

TIA.

Answer1:

If you launch another process, you are then required to use OS specific management tools of the windows.

You can often get the window id when the process is created, but managing its window is platform specific.

Qt hasn't left its application scope to do full shell access across platforms, but here is how you would do it in Windows:

<a href="http://qt-project.org/doc/qt-5/qprocess.html#processId" rel="nofollow">http://qt-project.org/doc/qt-5/qprocess.html#processId</a>

<a href="http://forums.codeguru.com/showthread.php?353149-How-to-Get-windows-Handle-using-Process-Id" rel="nofollow">http://forums.codeguru.com/showthread.php?353149-How-to-Get-windows-Handle-using-Process-Id</a>

<a href="https://stackoverflow.com/a/10258861/999943" rel="nofollow">https://stackoverflow.com/a/10258861/999943</a>

<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548(v=vs.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548(v=vs.85).aspx</a>

#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 that helps.

Recommend

  • accessing jsf bean from blazeds client
  • Loading an .ico from web and convert to BitmapSource
  • Resize image and change background Color
  • How save photo capture windows 8 c# metro app?
  • Why is this regex failing when adding anchors?
  • jquery ui datepicker error on beforeShowDay
  • How to maximize the goal in prolog?
  • Which video formats to use for Java ME in mobile phones?
  • How to use Exception Handling in Selenium Webdriver?
  • Why does this empty dict break shared references?
  • Ruby and class variables in inherit class
  • Hide buttons on title bar in Java
  • Run multiple queries from 1 SQL file showing result in multiple tables
  • wxPython: displaying multiple widgets in same frame
  • Meteor helpers not available in Angular template
  • Alert pop up with LWUIT
  • Disabling Alt-F4 on a Win Forms NotifyIcon
  • Email format validation in mvc3 view
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • How to add date and time under each post in guestbook in google app engine
  • Join two tables and save into third-sql
  • JSON with duplicate key names losing information when parsed
  • How to model a transition system with SPIN
  • How to make Safari send if-modified-since header?
  • ORA-29908: missing primary invocation for ancillary operator
  • Rearranging Cells in UITableView Bug & Saving Changes
  • How to pass list parameters for each object using Spring MVC?
  • How to get icons for entities from eclipse?
  • How to delete a row from a dynamic generate table using jquery?
  • AngularJs get employee from factory
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • coudnt use logback because of log4j
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • JaxB to read class hierarchy
  • Is there any way to bind data to data.frame by some index?
  • Converting MP3 duration time
  • Conditional In-Line CSS for IE and Others?