[Interest] Fwd: External Application window title is missing in QWindow
Sujan Dasmahapatra
yellowlemontree0821 at gmail.com
Sat Mar 21 07:36:35 CET 2020
hi all,
further I am setting the flags as follows. I am not sure the reason, it is
chopping the header and menubar? Please check the code below.
/////////////////////////////////////////////////////////////////////////////////////////////////////////
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);
QWidget *widget = QWidget::createWindowContainer(window);
widget->show();
return a.exec();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I am setting flags as desktop, since the program is 3rd party process
so ForeignWindow and title hint. But still
my widget is missing the header text and menu. it is showing the
middle part window properly.
I am stuck with my project, I need some one's help. Please try some
body if you could help me.
On Fri, 20 Mar 2020 at 11:39, Sujan Dasmahapatra <
yellowlemontree0821 at gmail.com> wrote:
> Dear Tony
>
> Thanks for your answer. first of all I am not repeating the question here.
> It is still a single thread. I am sorry for that.
>
> finally I am still stuck with it. If you or any one could help me I will
> highly appreciate it.
>
> My code snippet as follows.
>
> QWindow *window = new QWindow; //
>
> window = QWindow::fromWinId((WId)id);
>
> QWidget *widget = QWidget::createWindowContainer(window);
>
> widget->show();
>
> This shows me the external app, that I am launching using qprocess. when I am extracting the app, using FindWindow.HWND id = FindWindow(NULL, L"MyGL");
>
> It is showing in the widget, but menubar is missing,. so the desired result is not what that I want. It's missing the header Name
>
> and menu bar. Is there any othe way that I can achieve the full app window. I want to see the full app window into the widget
>
> without missing any component. Let me know some one if any how we can achieve this in Qt.
>
>
> regards
>
> sujan
>
>
>
> On Sat, 29 Feb 2020 at 15:25, Sujan Dasmahapatra <
> yellowlemontree0821 at gmail.com> wrote:
>
>> Dear Tony
>>
>> You're right, I am trying to access two separate apps, to be launched in
>> a single QTabwidget. but how does it matter, since even if I launch in
>> single Widget, it is still not coming. The header title is being correctly
>> used I am able to launch the app. But the app's header and menu bar, are
>> not being launched.
>>
>>
>> if (process_->waitForStarted(-1))
>>
>> {
>>
>> //0.00289917 0.28096 -0.180618 = 343
>>
>> HWND id = FindWindow(0, L"App.exe");
>>
>>
>> if (!id)
>>
>> return;
>>
>> QTimer t;
>>
>> t.start(2500);
>>
>> QWindow* window = QWindow::fromWinId((WId)id);
>>
>> QWidget* widget = QWidget::createWindowContainer(window);
>>
>> setCentralWidget(widget);
>>
>> }
>>
>> I am trying it on QMainWindow. And I think FindWindow itself is giving header text and menu less portion. So window and widget none
>>
>> is getting it. Can you suggest me what can be done for this.
>>
>> regards
>>
>> sujan
>>
>>
>>
>>
>> On Sat, 29 Feb 2020 at 07:53, Tony Rietwyk <tony at rightsoft.com.au> wrote:
>>
>>> Hi Sujan,
>>>
>>> It's not clear to me why you want to use fromWinId? Do you want two
>>> applications in separate processes to share the same windows? The title
>>> bar and menu are drawn by special win32 non-client events - but they may be
>>> suppressed, since the window is now being hosted in your app. With more
>>> information, maybe someone can help you - don't just repeat the same
>>> details in another post!
>>>
>>> Regards, Tony
>>>
>>>
>>> On 28/02/2020 11:13 pm, Sujan Dasmahapatra wrote:
>>>
>>>
>>> Dear Friends,
>>>
>>> My External Application Window title, is missing in my QWindow. I am
>>> trying to set this window on a Widget and finally I am displaying this
>>> widget on QScrollBar. But I am missing the Window title and menu bar from
>>> the app. Please check the code snippet below.
>>>
>>> QWindow* window = QWindow::fromWinId(id);
>>> QWidget* widget = QWidget::createWindowContainer(window);
>>> _gui->scrollArea->setWidget(widget);
>>>
>>> With this snippet, I can see the app is launched, but it's Title header
>>> text, is not opening.
>>>
>>> Please advise me what is going wrong. I have to see the window title and
>>> most importantly the menu bar as well.
>>>
>>> regards
>>> sujan
>>>
>>>
>>> _______________________________________________
>>> Interest mailing listInterest at qt-project.orghttps://lists.qt-project.org/listinfo/interest
>>>
>>> _______________________________________________
>>> Interest mailing list
>>> Interest at qt-project.org
>>> https://lists.qt-project.org/listinfo/interest
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200321/750dfc7e/attachment.html>
More information about the Interest
mailing list