473,386 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Workaround

(Type your message here)

--------------------------------
From: anijith m

Instead of using SystemEvents.PowerModeChanged delegate override WndProc.This is working fine for me

const int BROADCAST_QUERY_DENY = 0x424D5144; // Return this value to deny a query.
const int WM_POWERBROADCAST = 0x0218;
const int PBT_APMQUERYSUSPEND=0x0000;

protected override void WndProc(ref Message message)
{
base.WndProc(ref message);

if (message.Msg == WM_POWERBROADCAST )
{
switch(message.WParam.ToInt32())
{
case PBT_APMQUERYSUSPEND:
if( message.LParam.ToInt32() == 0x1)
{
DialogResult res = MessageBox.Show("Go to Standby ?","Standby",MessageBoxButtons.YesNo,MessageBoxIco n.Question );

if( res == DialogResult.No)
{
IntPtr deny = new IntPtr(BROADCAST_QUERY_DENY);
message.Result = deny;
}
else
message.Result = (IntPtr)1;
}
else
{
IntPtr deny = new IntPtr(BROADCAST_QUERY_DENY);
message.Result = deny;
}
break;
}
}
}

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>hbl3x343BUa/qSsdlgvpfQ==</Id>
Nov 17 '05 #1
0 2603

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: HI-Lab * the Social Technology | last post by:
Is there another function or a workaround to have same results of html_entity_decode in php 4.1.x? Thanks. -- ======================================= HI-LAB the Social Technology...
1
by: klappnase | last post by:
Hello everyone, there have already been a couple of threads about IDLE's sometimes annoying disability to use special characters (in my case I would like to use for example german umlauts like...
6
by: Chris | last post by:
hi, to convert excel files via csv to xml or whatever I frequently use the csv module which is really nice for quick scripts. problem are of course non ascii characters like german umlauts, EURO...
0
by: Jonas Smithson | last post by:
<div style="position: relative;> <!-- I'm the parent --> blah blah blah <div style="position: absolute; bottom: 0;> <!-- I'm the child --> blah blah blah </div> </div> The bottom of the...
1
by: Ronaldo N | last post by:
I'm trying to do some javascript form validation and I've discovered a rather difficult situation to handle with IE. Let's say there's a form with three input fields named "name", "method", or...
7
by: Justin Shen | last post by:
the output of the following codes is "greater than zero", which is rather strange! the correct one should be "not greater than zero" int a = 0x79de61c0; //2044617152; a += 0x12345678; //a is...
9
by: Mickey Segal | last post by:
The long-simmering Eolas patent dispute: http://www.microsoft.com/presspass/press/2003/oct03/10-06EOLASPR.mspx has led to an optional Microsoft Update: http://support.microsoft.com/kb/912945/en-us...
1
by: slyi | last post by:
Hi All, Does anyone use vml to force the printing of background-colors in IE clients? Regards, slyi eg: <html xmlns:v="urn:schemas-microsoft-com:vml" >
37
by: Allen Browne | last post by:
If you develop for others, you probably have multiple versions of Access installed so you can edit and create MDEs for clients in different versions. This works fine under Windows XP, even with...
0
by: William Johnston | last post by:
Hi, A support technician proposed a workaround to black images created for thumbnails. The code to create a thumbnail is below: //passes results to Response.OutputStream private void...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.