Detecting window with current focus (even in another thread) 
Author Message
 Detecting window with current focus (even in another thread)

My FlashCurrentWindow function does not flash the window with current focus
and I cannot understand why. I want to be able to flash any window with
current focus of any thread. Can anyone tell me what I'm doing wrong. The
code for this function is as follows:

 HWND hWndCurrentFocus;
 HWND hWndForeground;
 DWORD idForeground;
 DWORD idCurrent;
 DWORD foregroundProcessId;
 int i;

 idCurrent = GetCurrentThreadId();
 hWndForeground = GetForegroundWindow();
 idForeground = GetWindowThreadProcessId(hWndForeground,
&foregroundProcessId);

 if(idForeground != idCurrent)
    AttachThreadInput(idForeground, idCurrent, TRUE);

 hWndCurrentFocus = GetFocus();

 for(i=0; i<numTimes; i++)
  FlashWindow(hWndCurrentFocus, TRUE);

 if(idForeground != idCurrent)
  AttachThreadInput(idForeground, idCurrent, FALSE);



Sat, 16 Mar 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Detecting window with current focus (even in another thread)

2. Environment.UserDomainName returns local computer name even though current user is logged into a domain

3. Receiving keyboard events, even if app does not have focus

4. determining if current thread is main thread

5. problems detecting a right-click even on a rich edit control

6. Determine if current thread is a worker thread

7. DataGrid's Click event fires before setting the current row's focus

8. Status line message for current focus control.

9. Changing current view focus

10. thread error even with criticalsection

11. Detecting Autoplay's Current Active Cdrom Drive

12. thread error even with criticalsection

 

 
Powered by phpBB® Forum Software