16,467
社区成员
发帖
与我相关
我的任务
分享
BOOL 设置窗口到前台(HWND hwnd)
{
BOOL ret;
DWORD foreID = GetWindowThreadProcessId(::GetForegroundWindow(), NULL);
DWORD curID = GetCurrentThreadId();
if (foreID != curID)
{
AttachThreadInput(foreID, curID, TRUE);
ret = SetForegroundWindow(hwnd);
AttachThreadInput(foreID, curID, FALSE);
}
else
{
ret = SetForegroundWindow(hwnd);
}
return ret;
}