[Interest] Fwd: External Application window title is missing in QWindow
Rainer Wiesenfarth
rainer_wiesenfarth at trimble.com
Mon Mar 23 07:07:13 CET 2020
Hi Sujan,
I did not follow the rest of the discussion, but at least your sample code
contains an error:
On Sat, Mar 21, 2020 at 7:38 AM Sujan Dasmahapatra <
yellowlemontree0821 at gmail.com> wrote:
> [...]
>
> /////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> int main(int argc, char *argv[])
>
> {
>
> QApplication a(argc, argv);
>
> QProcess *process_fusion = new QProcess();
>
> process_fusion->startDetached(".\\MGL.exe C:\\T1.nii");
>
> Sleep(20000);
>
> //0.00289917 0.28096 -0.180618 = 343 // Windows: Find HWND by window title
>
> HWND id = FindWindow(NULL, L"MGL");
>
> if (!id)
>
> return -1;
>
>
> // Linux: Find Window ID by running xwininfo externally before compiling this test
>
> //WId id = 0x4600085
>
> QTimer t;
>
> t.start(2500);
>
> // Part 1
>
> QWindow *window = new QWindow;
>
> window->setFlags(Qt::Desktop | Qt::ForeignWindow | Qt::WindowTitleHint);
>
> window = QWindow::fromWinId((WId)id);
>
>
The above line *replaces *your previously created window, including the
flags you set on it. Maybe this works:
...
// Part 1
QWindow *window = QWindow::fromWinId((WId)id);
window->setFlags(Qt::Desktop | Qt::ForeignWindow | Qt::WindowTitleHint);
QWidget *widget = QWidget::createWindowContainer(window);
...
QWidget *widget = QWidget::createWindowContainer(window);
>
> widget->show();
>
> return a.exec();
>
> }
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> [...]
>
>
Cheers, Rainer
--
Software Engineer | Trimble Imaging Division
Rotebühlstraße 81 | 70178 Stuttgart | Germany
Office +49 711 22881 0 | Fax +49 711 22881 11
http://www.trimble.com/imaging/ | http://www.inpho.de/
Trimble Germany GmbH, Am Prime Parc 11, 65479 Raunheim
Eingetragen beim Amtsgericht Darmstadt unter HRB 83893,
Geschäftsführer: Rob Reeder, Jürgen Kesper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200323/0bfd2391/attachment.html>
More information about the Interest
mailing list