mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Ally UI fix https://github.com/seerge/g-helper/issues/2341
This commit is contained in:
2
app/Handheld.Designer.cs
generated
2
app/Handheld.Designer.cs
generated
@@ -971,7 +971,7 @@
|
|||||||
//
|
//
|
||||||
// checkController
|
// checkController
|
||||||
//
|
//
|
||||||
checkController.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
checkController.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
checkController.AutoSize = true;
|
checkController.AutoSize = true;
|
||||||
checkController.BackColor = SystemColors.ControlLight;
|
checkController.BackColor = SystemColors.ControlLight;
|
||||||
checkController.Location = new Point(650, 41);
|
checkController.Location = new Point(650, 41);
|
||||||
|
|||||||
@@ -27,14 +27,16 @@ public class NativeMethods
|
|||||||
private const int MONITOR_OFF = 2;
|
private const int MONITOR_OFF = 2;
|
||||||
|
|
||||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||||
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
|
private static extern IntPtr SendMessage(nint hWnd, int hMsg, int wParam, int lParam);
|
||||||
|
|
||||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||||
private static extern uint FormatMessage(uint dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, out string lpBuffer, uint nSize, IntPtr Arguments);
|
private static extern uint FormatMessage(uint dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, out string lpBuffer, uint nSize, IntPtr Arguments);
|
||||||
|
|
||||||
public static void TurnOffScreen()
|
public static void TurnOffScreen()
|
||||||
{
|
{
|
||||||
IntPtr result = SendMessage(-1, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, (IntPtr)MONITOR_OFF);
|
Form f = new Form();
|
||||||
|
IntPtr result = SendMessage(f.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_OFF);
|
||||||
|
|
||||||
if (result == IntPtr.Zero)
|
if (result == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
int error = Marshal.GetLastWin32Error();
|
int error = Marshal.GetLastWin32Error();
|
||||||
|
|||||||
Reference in New Issue
Block a user