C#
[DllImport("User32.dll")]
public static extern int SendMessage
(IntPtr hWnd,
uint Msg,
uint wParam,
uint lParam);
public const uint WM_SYSCOMMAND = 0x112;
public const uint SC_SCREENSAVE = 0xF140;
public enum SpecialHandles
{
HWND_DESKTOP = 0x0,
HWND_BROADCAST = 0xFFFF
}
public static void TurnOnScreenSaver()
{
SendMessage(
new IntPtr((int)SpecialHandles.HWND_BROADCAST),
WM_SYSCOMMAND,
SC_SCREENSAVE,
0);
}
this code works fine. i found it from this forum.
i need another method like TurnOnScreenSaver() that stops the screen
saver. That is i wanna turn on the screen saver first (already done)
then on a specific condition i wanna turn off the screen saver and
continue the process(on and off)
Gomathi PalaniswamyRank #714 · 3.3K reputationPosted Oct 11, 2010, 8:39 PM EDT
see the below link,
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/b3ece72d-18b1-4267-94f3-5ad57cbdf84c
learner learner26 reputationPosted Oct 12, 2010, 10:09 PM EDT
i visited your given link. But i think that are not so easy as the following method
public static void TurnOnScreenSaver()
{
SendMessage( new IntPtr((int)SpecialHandles.HWND_BROADCAST), WM_SYSCOMMAND, SC_SCREENSAVE, 0);
}
If i could modify this method to turn off screen saver, it would be very much effective