I have an application that when it is locked I activate a password dialog. I
trigger it by adding a message filter.
public class AuthenticationMessageFilter : IMessageFilter
{
private const int SC_RESTORE = 0xF120;
private const int SC_MAXIMIZE = 0xF030;
private const int WM_SYSCOMMAND = 0x112;
public bool PreFilterMessage(ref Message m)
{
bool bKeepLocked = false;
if (m.Msg == WM_SYSCOMMAND)
{
if ((int)m.WParam == SC_MAXIMIZE || (int)m.WParam == SC_RESTORE)
{
...... here do the authentication
}
}
}
}
and activated through:
AuthenticationMessageFilter filter = new AuthenticationMessageFilter();
Application.AddMessageFilter(filter);
This code works great if you switch using either alt-tab or the task bar,
however when you use task manager switch to ---- I cannot for the life of me
figure out what message to trap.
So my question is how do I trap the switchTo message from task manager.
Thanks,
SwedeFlyer
Have you tried usng Spy++ to see what messages your window is receiving?
"C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\spyxx.exe"
Jason Newell
Software Engineer
www.jasonnewell.net
> I have an application that when it is locked I activate a password dialog. I
> trigger it by adding a message filter.
[quoted text clipped - 30 lines]
> Thanks,
> SwedeFlyer
SwedeFlyer - 20 Sep 2007 21:18 GMT
Yes I get several activate messages to my application for all child windows.
now I guess I could trap one of them looking at my current window state
(minimized if locked) and do the authentication and then ignore the rest of
them. The reason why I am not keen on that approach is that the prefilter
message get all windows messages to the application (mouse_move etc.),
Whatever processing gets done there has to be slim and fast. I guess what I
am looking for is some recipe on how to catch the task manager switch-to
action when it targets your application.
Someone must have solved this already I would think, that's why I posted it.
Cheers,
Peter
> Have you tried usng Spy++ to see what messages your window is receiving?
>
[quoted text clipped - 38 lines]
> > Thanks,
> > SwedeFlyer