Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted

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

"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
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...