mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-10 21:23:40 +01:00
Windows: Don't use the foreground setting code if the window is already foreground
This commit is contained in:
parent
ece26c7481
commit
1e204da223
@ -6954,22 +6954,25 @@ void BringToForeground(HWND hWnd)
|
||||
DWORD dwThisTID = ::GetCurrentThreadId(),
|
||||
dwCurrTID = ::GetWindowThreadProcessId(hCurrWnd,0);
|
||||
|
||||
if(dwThisTID != dwCurrTID)
|
||||
if (hCurrWnd != hWnd)
|
||||
{
|
||||
::AttachThreadInput(dwThisTID, dwCurrTID, TRUE);
|
||||
if(dwThisTID != dwCurrTID)
|
||||
{
|
||||
::AttachThreadInput(dwThisTID, dwCurrTID, TRUE);
|
||||
|
||||
::SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT,0,&lockTimeOut,0);
|
||||
::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,0,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
|
||||
::SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT,0,&lockTimeOut,0);
|
||||
::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,0,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
|
||||
|
||||
::AllowSetForegroundWindow(ASFW_ANY);
|
||||
}
|
||||
::AllowSetForegroundWindow(ASFW_ANY);
|
||||
}
|
||||
|
||||
::SetForegroundWindow(hWnd);
|
||||
::SetForegroundWindow(hWnd);
|
||||
|
||||
if(dwThisTID != dwCurrTID)
|
||||
{
|
||||
::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,(PVOID)lockTimeOut,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
|
||||
::AttachThreadInput(dwThisTID, dwCurrTID, FALSE);
|
||||
if(dwThisTID != dwCurrTID)
|
||||
{
|
||||
::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,(PVOID)lockTimeOut,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
|
||||
::AttachThreadInput(dwThisTID, dwCurrTID, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TCMOUNT
|
||||
|
Loading…
Reference in New Issue
Block a user