首页 >> 中药养生

使用编写的一个定时关机程序之四的

中药养生  2021年09月06日  浏览:5 次

private void buttonInvoke_Click(object sender, entArgs e)

{

if (teTimePicker_Validated())

{

art();

abled = false;

abled = false;

sible = true;

abled = false;

}

}

}

}

using System;

using xt;

using agnostics;

using eropServices;

namespace TimerComputerShutdown{

/// summary

/// Specifies the type of restart options that an application can use.

/// /summary

public enum RestartOptions {

/// summary

/// Shuts down all processes running in the security context of the process that called the ExitWindowsEx function. Then it logs the user off.

/// /summary

LogOff = 0,

/// summary

/// Shuts down the system and turns off the power. The system must support the power-off feature.

/// /summary

PowerOff = 8,

/// summary

/// Shuts down the system and then restarts the system.

/// /summary

Reboot = 2,

/// summary

/// Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped. If the system supports the power-off feature, the power is also turned off.

/// /summary

ShutDown = 1,

/// summary

/// Suspends the system.

/// /summary

Suspend = -1,

/// summary

/// Hibernates the system.

/// /summary

懂得疯狂的添加外部链接 Hibernate = -2,

}

/// summary

/// An LUID is a 64-bit value guaranteed to be unique only on the system on which it was generated. The uniqueness of a locally unique identifier (LUID) is guaranteed only until the system is restarted.

/// /summary

[StructLayout(quential, Pack=1)]

internal struct LUID {

/// summary

/// The low order part of the 64 bit value.

/// /summary

public int LowPart;

/// summary

/// The high order part of the 64 bit value.

/// /summary

public int HighPart;

}

/// summary

/// The LUID_AND_ATTRIBUTES structure represents a locally unique identifier (LUID) and its attributes.

/// /summary

[StructLayout(quential, Pack=1)]

internal struct LUID_AND_ATTRIBUTES {

/// summary

/// Specifies an LUID value.

/// /summary

public LUID pLuid;

/// summary

/// Specifies attributes of the LUID. This value contains up to 32 one-bit flags. Its meaning is dependent on the definition and use of the LUID.

/// /summary

public int Attributes;

}

/// summary

/// The TOKEN_PRIVILEGES structure contains information about a set of privileges for an access token.

/// /summary

[StructLayout(quential, Pack=1)]

internal struct TOKEN_PRIVILEGES {

/// summary

/// Specifies the number of entries in the Privileges array.

/// /summary

public int PrivilegeCount ;

/// summary

/// Specifies an array of LUID_AND_ATTRIBUTES structures. Each structure contains the LUID and attributes of a privilege.

/// /summary

public LUID_AND_ATTRIBUTES Privileges ;

}

/// summary

/// Implements methods to exit Windows.

/// /summary

public class WindowsController {

/// summaryRequired to enable or disable the privileges in an access token./summary

private const int TOKEN_ADJUST_PRIVILEGES = 0x20;

/// summaryRequired to query an access token./summary

private const int TOKEN_QUERY = 0x8;

/// summaryThe privilege is enabled./summary

private const int SE_PRIVILEGE_ENABLED = 0x2;

/// summarySpecifies that the function should search the system message-table resource(s) for the requested message./summary

private const int FORMAT_MESSAGE_FROM_SYSTEM = 0x1000;

/// summaryForces processes to terminate. When this flag is set, the system does not send the WM_QUERYENDSESSION and WM_ENDSESSION messages. This can cause the applications to lose data. Therefore, you should only use this flag in an emergency./summary

private const int EWX_FORCE = 4;

/// summary

/// The LoadLibrary function maps the specified executable module into the address space of the calling process.

/// /summary

/// param name=\"lpLibFileName\"Pointer to a null-terminated string that names the executable module (either a .dll or .exe file). The name specified is the file name of the module and is not related to the name stored in the library module itself, as specified by the LIBRARY keyword in the module-definition (.def) file./param

/// returnsIf the function succeeds, the return value is a handle to the the function fails, the return value is NULL. To get extended error information, call tLastWin32Error./br/returns

[ DllImport( \"l\", EntryPoint=\"LoadLibraryA\", CharSet=si )]

private static extern IntPtr LoadLibrary(string lpLibFileName);

/// summary

/// The FreeLibrary function decrements the reference count of the loaded dynamic-link library (DLL). When the reference count reaches zero, the module is unmapped from the address space of the calling process and the handle is no longer valid.

/// /summary

/// param name=\"hLibModule\"Handle to the loaded DLL module. The LoadLibrary or GetModuleHandle function returns this handle./param

/// returnsIf the function succeeds, the return value is the function fails, the return value is zero. To get extended error information, call tLastWin32Error./br/returns

[ DllImport( \"l\", EntryPoint=\"FreeLibrary\", CharSet=si )]

private static extern int FreeLibrary(IntPtr hLibModule);

鏌ョ湅鏈枃鏉ユ簮

哈尔滨哪医院治疗男科好
儿童健脾胃的药排行榜
梧州治白癜风医院哪家好
友情链接