窗口在ShowWindow之后不接受按键(browserPtr,3)
Window do not accept key press after ShowWindow(browserPtr, 3)
我的目标是从另一个进程停靠浏览器窗口进入我的应用程序。
我有一个面板hwnd,它将是一个父面板,以及浏览器窗口的hwnd。
这是一个代码:
ShowWindow(browserPtr, 3);
SetParent(browserPtr, browserContainerPanel.Handle);
MoveWindow(browserPtr, 0, 0, browserContainerPanel.Width, browserContainerPanel.Height, true);
在这种情况下,浏览器窗口变成了一个子窗口,并正确放置。但它停止接受键盘输入,无法集中焦点。
如果我不调用ShowWindow,除了窗口的位置和大小之外,所有操作都正常。Wihout ShowWindow我无法设置大小和位置。MoveWindow刚刚被忽略。
为什么停靠窗口不接受用户输入?我做错了什么?
更新
当前我的代码:
/// Attach container app input thread to the running app input thread, so that
/// the running app receives user input.
FAppThreadID = GetWindowThreadProcessId(window, new IntPtr());
AttachThreadInput(GetCurrentThreadId(), FAppThreadID, true);
/// Changing parent of the running app to our provided container control
SetParent(window, container);
SendMessage(container, WM_UPDATEUISTATE, UIS_INITIALIZE, 0);
UpdateWindow(window);
/// Make the running app to fill all the client area of the container
SetWindowPos(window, 0, 0, 0, 1000, 1000, SWP_NOZORDER);
SetForegroundWindow(window);
但在这种情况下,由于某些原因,窗口大小被忽略。然而,只要专注和投入,一切都可以。如何固定尺寸?
您还应该在浏览器窗口上调用SetFocus,以便向其发送用户输入。
相关文章:
- 如何引用 obj1 并在 NULL 时调用 show 方法
- 在qt中更改show()上的窗口位置
- 让对象知道它创建的 show 函数中发生了什么
- QMainWindow 不是 .show() 但 .showFullScreen() 可以工作
- QWidgets 在 show() 之后不显示 -- c++/Qt5.
- QInputDialog & Ththreader(worker,show dialog,等待输入,继续)
- QTableView does not show up
- 错误:课堂没有名为“ Show”的成员
- QMainWindow在show()之后立即关闭
- 窗口在ShowWindow之后不接受按键(browserPtr,3)
- 在C++Builder上无法访问TObject.Show()
- Qt 4.8.5 Understanding QMessagebox .exec() and .show()
- QSystemTrayIcon does not show up
- 错误:“虚拟布尔值 wxTopLevelWindowGTK::Show(bool)”无法访问
- 每个 QT 小部件都有'show'信号吗?
- Qt5应用程序关闭时崩溃(QWidget::show)
- 我的'show progress thread'在计数时无法运行
- 通过值或引用传递C++中的默认catch-show语句
- 如何在这个try-show-catch代码中对异常进行排序
- QDialog show()后面跟着返回结果操作