Grabbing window messages

  • Thread starter Thread starter Darren Mar-Elia
  • Start date Start date
D

Darren Mar-Elia

I've got a WinForms app. Essentially all this app is is a notification try
icon with an optional configuration form. I am trying to capture the
WM_SETTINGCHANGE window message coming to my app. Since the app has no form,
I'm doing this by adding a MessageFilter to the form. In my MessageFilter
class, I implement the PreFilterMessage method to grab the event and test
for the WM_SETTINGCHANGE code (0x001a). however, I don't seem to ever get
that message, even though I know its getting sent. Not sure what I'm
missing. During debug, I know I'm getting some window messages, but not the
one I need!

Any ideas on a different way to skin this?
 
You can try catching it in an override of your form's WndProc.

protected override void WndProc(ref Message m)
{
if (m.Msg == 0x1a)
{
Console.WriteLine(m);
}
base.WndProc(ref m);
}
========================
Clay Burch
Syncfusion, Inc.
 
Clay-
I tried that originally, but because I don't have an active form up most of
the time, it didn't seem to catch any messages. I was trying to figure out
if I could create some kind of invisible form but I didn't have any luck
with that.

Darren
 
Back
Top