Click here to Skip to main content
15,887,083 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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

-- modified at 19:55 Friday 13th January, 2006
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 
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 
GeneralRe: Capture all keyboard input inside a dialog Pin
kevincwong13-Jan-06 7:03
kevincwong13-Jan-06 7:03 
GeneralRe: Capture all keyboard input inside a dialog Pin
James R. Twine13-Jan-06 7:12
James R. Twine13-Jan-06 7:12 
GeneralRe: Capture all keyboard input inside a dialog Pin
Rajesh R Subramanian13-Jan-06 18:51
professionalRajesh R Subramanian13-Jan-06 18:51 
GeneralRe: Capture all keyboard input inside a dialog Pin
kevincwong15-Jan-06 18:21
kevincwong15-Jan-06 18:21 
AnswerRe: Capture all keyboard input inside a dialog Pin
Anilkumar K V13-Jan-06 0:43
Anilkumar K V13-Jan-06 0:43 
QuestionStrange Question about GetNamedSecurityInfo() API to retrieve DACL of a network share folder Pin
wangdave12-Jan-06 22:37
wangdave12-Jan-06 22:37 
AnswerRe: Strange Question about GetNamedSecurityInfo() API to retrieve DACL of a network share folder Pin
Blake Miller17-Jan-06 7:35
Blake Miller17-Jan-06 7:35 

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.