mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 04:54:38 +03:00
16 lines
433 B
C++
16 lines
433 B
C++
|
|
#include "guihelper.h"
|
|
|
|
#include <QWidget>
|
|
|
|
#include <windows.h>
|
|
|
|
void Windows_QWidget_SetForegroundWindow(QWidget* w) {
|
|
HWND hForgroundWnd = GetForegroundWindow();
|
|
DWORD dwForeID = ::GetWindowThreadProcessId(hForgroundWnd, NULL);
|
|
DWORD dwCurID = ::GetCurrentThreadId();
|
|
::AttachThreadInput(dwCurID, dwForeID, TRUE);
|
|
::SetForegroundWindow((HWND) w->winId());
|
|
::AttachThreadInput(dwCurID, dwForeID, FALSE);
|
|
}
|