qt在windows上通过窗口句柄操作窗口

HWND appwnd;
appwnd = (HWND)w.winId();
QString ClassName("Qt5QWindowIcon");
QString AppName = QStringLiteral("GG");
 
LPCWSTR app = reinterpret_cast(ClassName.data());
LPCWSTR appCaption = reinterpret_cast(AppName.data());
 
appwnd = ::FindWindow(app, appCaption);
appwnd = ::FindWindow(app, appCaption);

 

HWND hwndLogin=FindWindow(NULL,L"登录");

QWidget* widgetLogin=QWidget::find((WId)hwndLogin);

QWindow* windowLogin=QWindow::fromWinId((WId)hwndLogin);

windowLogin->showFullScreen();

 

::ShowWindow(hWndPrevious,
SW_RESTORE);
// 将主窗激活
::SetForegroundWindow(hWndPrevious);
// 将主窗的对话框激活
::SetForegroundWindow(
::GetLastActivePopup(hWndPrevious));


 

你可能感兴趣的:(程序员日记)