|
|
|
date: Sun, 18 Nov 2007 04:03:13 -0800 (PST),
group: microsoft.public.platformsdk.ui_shell
back
BringWindowToTop is hanging on vista..
Hi
i have an application which shows dialogbox on top of all
application . I am using the following code sequence..
BOOL BringWindowOnTop(HWND hWnd)
{
#ifdef _VISTA
// TODO:
// following code for non vista is hanging in vista when used,
// need to figure out the reason and fix it
return TRUE;
#else
HWND hwndForeground = GetForegroundWindow();
// gets the current top most window on the screen.
DWORD dwFGProcessId = 0;
DWORD dwFGThreadId = GetWindowThreadProcessId(hwndForeground,
&dwFGProcessId);
DWORD dwThisThreadId = GetCurrentThreadId();
// attaches the current thread to window on top
AttachThreadInput(dwThisThreadId, dwFGThreadId, TRUE);
::ShowWindow(hWnd, SW_RESTORE);
// Now the window on top is also in the set of windows we are
intersted,
// so bring window on top will put us on top of all windows
BringWindowToTop(hWnd);
SetFocus(hWnd);
// detach from the previously attached thread
AttachThreadInput(dwThisThreadId, dwFGThreadId, FALSE);
return 0;
#endif
}
This api is called from dialogbox in Oninitdialog method it works fine
on xp system but it hanges
on vista when ::ShowWindow(hWnd, SW_RESTORE); is called .
Here the forground window is windows explorer .
and current thread is a user mode application thread which is
different form windows explorer.
Can you please tell me how to fix this on vista ?
Thanks
Rajender saini
date: Sun, 18 Nov 2007 04:03:13 -0800 (PST)
author: unknown
Re: BringWindowToTop is hanging on vista..
On Nov 18, 5:03 pm, rajendersa...@gmail.com wrote:
> Hi
>
> i have an application which shows dialogbox on top of all
> application . I am using the following code sequence..
>
> BOOL BringWindowOnTop(HWND hWnd)
> {
> #ifdef _VISTA
> // TODO:
> // following code for non vista is hanging in vista when used,
> // need to figure out the reason and fix it
> return TRUE;
> #else
> HWND hwndForeground = GetForegroundWindow();
>
> // gets the current top most window on the screen.
> DWORD dwFGProcessId = 0;
> DWORD dwFGThreadId = GetWindowThreadProcessId(hwndForeground,
> &dwFGProcessId);
>
> DWORD dwThisThreadId = GetCurrentThreadId();
>
> // attaches the current thread to window on top
> AttachThreadInput(dwThisThreadId, dwFGThreadId, TRUE);
>
> ::ShowWindow(hWnd, SW_RESTORE);
>
> // Now the window on top is also in the set of windows we are
> intersted,
> // so bring window on top will put us on top of all windows
> BringWindowToTop(hWnd);
> SetFocus(hWnd);
>
> // detach from the previously attached thread
> AttachThreadInput(dwThisThreadId, dwFGThreadId, FALSE);
> return 0;
> #endif
>
> }
>
> This api is called from dialogbox in Oninitdialog method it works fine
> on xp system but it hanges
> on vista when ::ShowWindow(hWnd, SW_RESTORE); is called .
>
> Here the forground window is windows explorer .
> and current thread is a user mode application thread which is
> different form windows explorer.
>
> Can you please tell me how to fix this on vista ?
>
> Thanks
> Rajender saini
No body is replying , are u able to understand my question?
date: Tue, 20 Nov 2007 22:18:28 -0800 (PST)
author: unknown
|
|