July 9th, 1998, 05:35 PM
#1
SetForegroundWindow in Windows98/NT5
I am trying to find a way around the new behaviour of
SetForegroundWindow in Windows 98 and NT 5.
Now it performs a FlashWindowEx call instead of allowing
an application to force its window into the foreground.
Anyone have a workaround?
Undocumented flag?
FYI: SystemParameterInfo( SPI_SETFOREGROUNDFLASHCOUNT, 0 )
causes the window to flash forever.
Thanks in advance,
Adrian
July 10th, 1998, 02:44 AM
#2
Re: SetForegroundWindow in Windows98/NT5
Hi Adrian,
use instead of SPI_SETFOREGROUNDFLASHCOUNT the flag SPI_SETFOREGROUNDLOCKTIMEOUT with zero as value.
Ewald
July 23rd, 1998, 01:57 PM
#3
Re: SetForegroundWindow in Windows98/NT5
Use AttachThreadInput to connect input state with the active thread. This will cause Windows 98 to perform SetForegroundWindow as in Win95. It also works in NT 5.0.
Try this code (error check omitted):
DWORD dwThreadId = GetCurrentThreadId();
DWORD dwActiveThreadId = NULL;
CWnd* pActiveWnd = GetForegroundWindow();
dwActiveThreadId = GetWindowThreadProcessId( pActiveWnd->m_hWnd, NULL );
AttachThreadInput( dwThreadId, dwActiveThreadId, TRUE );
pPopup->SetForegroundWindow();
AttachThreadInput( dwThreadId, dwActiveThreadId, FALSE );
This workaround works in my code, but AttachThreadInput() has some side effects, you may want to consult documentation on it.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks