Not getting all window messages from IMessageFilter?

J

johnf

Trying to get a see windows messages using IMessageFilter interface however
it does not seem to get all window messages. Specifically I am looking for
the WM_POWERBROADCAST. I override wndproc which shows the msg successfully
but nothing shows up when using IMessageFilter. Am i misunderstanding
something? Here is sample code:
public class MyFilter : IMessageFilter
{

const int WM_POWERBROADCAST = 0x0218;
public bool PreFilterMessage(ref Message m)
{
if m.Msg == WM_POWERBROADCAST)
{
Console.WriteLine("Power Broadcast recieved.");
}
return false;
}
}
class MainForm : Form
{

public MainForm() //MainForm's constructor
{
}
public static void Main()
{

Application.AddMessageFilter(new MyFilter());
Application.Run(new MainForm());
}
}
 
J

johnf

Actually the link is for Mobile PC's (laptops?) not CE. The topic covers
Power Management in Windows XP and Vista. Thanks for the input Pete, if
anyone has anything else, greatly appreciated...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top