Click here to Skip to main content
15,896,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCan i pass MFC Objects in between thread ? Pin
vikas amin12-Jan-06 23:20
vikas amin12-Jan-06 23:20 
AnswerRe: Can i pass MFC Objects in between thread ? Pin
Owner drawn12-Jan-06 23:31
Owner drawn12-Jan-06 23:31 
AnswerRe: Can i pass MFC Objects in between thread ? Pin
Stephen Hewitt12-Jan-06 23:41
Stephen Hewitt12-Jan-06 23:41 
AnswerRe: Can i pass MFC Objects in between thread ? Pin
Roger Stoltz12-Jan-06 23:45
Roger Stoltz12-Jan-06 23:45 
AnswerRe: Can i pass MFC Objects in between thread ? Pin
Prakash Nadar12-Jan-06 23:45
Prakash Nadar12-Jan-06 23:45 
AnswerRe: Can i pass MFC Objects in between thread ? Pin
ThatsAlok15-Jan-06 18:19
ThatsAlok15-Jan-06 18:19 
AnswerThank you everyone Pin
vikas amin16-Jan-06 1:10
vikas amin16-Jan-06 1:10 
Questionwprintf() could not display unicode chars which is > 255 to console? Pin
wangdave12-Jan-06 23:11
wangdave12-Jan-06 23:11 
QuestionHow to block a window ? Pin
leenmie12-Jan-06 22:50
leenmie12-Jan-06 22:50 
AnswerRe: How to block a window ? Pin
Stephen Hewitt12-Jan-06 23:49
Stephen Hewitt12-Jan-06 23:49 
AnswerRe: How to block a window ? Pin
Roger Stoltz13-Jan-06 0:00
Roger Stoltz13-Jan-06 0:00 
GeneralRe: How to block a window ? Pin
Stephen Hewitt13-Jan-06 0:14
Stephen Hewitt13-Jan-06 0:14 
GeneralRe: How to block a window ? Pin
leenmie13-Jan-06 0:44
leenmie13-Jan-06 0:44 
GeneralRe: How to block a window ? Pin
Stephen Hewitt13-Jan-06 1:06
Stephen Hewitt13-Jan-06 1:06 
AnswerRe: How to block a window ? Pin
Koushik Biswas13-Jan-06 13:51
Koushik Biswas13-Jan-06 13:51 
AnswerRe: How to block a window ? Pin
toxcct13-Jan-06 0:53
toxcct13-Jan-06 0:53 
GeneralRe: How to block a window ? Pin
leenmie13-Jan-06 2:15
leenmie13-Jan-06 2:15 
AnswerRe: How to block a window ? Pin
FarPointer13-Jan-06 3:47
FarPointer13-Jan-06 3:47 
AnswerRe: How to block a window ? Pin
Koushik Biswas13-Jan-06 13:55
Koushik Biswas13-Jan-06 13:55 
I am assuming you are writing the code for the window you want to keep always activated. If yes, you can handle "WM_ACTIVATEAPP" in its WndProc. This message is sent to any window that is about to lose focus or to gain focus, the difference between losing and gaining focus is the WPARAM - it is FALSE if it islosing focus.

Thus, you can use that message to trap the fact that you are about to lose focus (some other window is trying to come on top). Once you sense that, you can take corrective action by calling

SetWindowPos( hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );<br />
ShowWindow( hWnd, SW_SHOWNORMAL );


That should return the window to active state - quite rude to other windows though!

Now, assuming that you are NOT directly writing the code of this window, you can write a small hidden program that will always run in the background, and constantly call GetForegroundWindow() [see here[^]] or GetTopWindow() [see here[^]], and compare the HWND value it gets with the handle of your window. To do that, it must first get the HWND handle of your window, which it can initially get by calling FindWindow(). If it ever sees that the top window is something else than your window, it can call the same functions as described above with the handle of your window to bring it on top again.

Disclaimer - I have not tried this actually. Let me know if this works.

Koushik Biswas
GeneralRe: How to block a window ? Pin
leenmie13-Jan-06 15:47
leenmie13-Jan-06 15:47 
QuestionCapture all keyboard input inside a dialog Pin
kevincwong12-Jan-06 22:38
kevincwong12-Jan-06 22:38 
AnswerRe: Capture all keyboard input inside a dialog Pin
Stephen Hewitt12-Jan-06 23:50
Stephen Hewitt12-Jan-06 23:50 
AnswerRe: Capture all keyboard input inside a dialog Pin
Rajesh R Subramanian13-Jan-06 0:31
professionalRajesh R Subramanian13-Jan-06 0:31 
GeneralRe: Capture all keyboard input inside a dialog Pin
kevincwong13-Jan-06 6:02
kevincwong13-Jan-06 6:02 
GeneralRe: Capture all keyboard input inside a dialog Pin
James R. Twine13-Jan-06 6:24
James R. Twine13-Jan-06 6:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.