Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
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

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us