rmatthew Posted January 22, 2003 Posted January 22, 2003 I have read that the system will broadcast power status changes on WM_POWERBROADCAST. Ok - call me stupid but I can't seem to find an example on how to receive/trap these messages. I have not needed to do this kind of thing in the past (so I guess it is something I have missed along the way :) ) Any help would be appreciated. Thanks Quote
*Experts* Nerseus Posted January 22, 2003 *Experts* Posted January 22, 2003 I'm not sure if this will work for you, but you can override the WndProc of your form to check for messages. Some won't get sent still as they're being passed on to appropriate controls - but you can try it and see if it works. I'm sorry this is C# - just noticed this is the VB forum. I don't know how to convert override into VB.NET :) protected override void WndProc(ref System.Windows.Forms.Message msg) { // Replace WM_LBUTTONDOWN with WM_POWER... (I don't konw its value) const int WM_LBUTTONDOWN = 0x201; if(msg.Msg == WM_LBUTTONDOWN) { // Do something Debug.WriteLine("hit"); } base.WndProc(ref msg); } -nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts