2
Answers

turn OFF screen saver programmatically

learner learner

learner learner

14y
10.9k
1
[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)
Answers (2)
0
Suthish Nair
NA 31.7k 4.6m 14y

If this query got resolved then please Accept the post that helped you as Answer.
So other members can easily find the answers.
0
Suthish Nair
NA 31.7k 4.6m 14y

Sam is right.

change your code too
1. if (chineseGrade=="A")
2. use double chineseGPA or chineseGPA = Convert.ToDecimal(4.0);

0
Sam Hobbs
NA 28.7k 1.3m 14y
chineseGrade is a string variable but you are using it as if it is a method. The compiler is not psychic and neither are we. What is it that you need to do? As best as I understand your question, you are calculating a GPA for Chinese differently than for other people but as far as I know the Chinese are the same as everyone else. So perhaps the answer is that you can just use the same calculation for Chinese people as everyone else.