Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "sleep" in [All]

winspool

.

private static extern bool FlushPrinter(IntPtr hPrinter,IntPtr pBuf,Int32 cbBuf,out Int32 pcWritten,Int32 cSleep);

ntdll

.

using System.Threading; // for test main (Thread.Sleep) only

.

        Thread.Sleep(1500);

Structures

.

   public POWER_ACTION_POLICY SleepButtonAc;

.

   public POWER_ACTION_POLICY SleepButtonDc;

.

   Public SleepButtonAc As POWER_ACTION_POLICY

.

   Public SleepButtonDc As POWER_ACTION_POLICY

.

        ///Computer Sleep key

.

        SLEEP = 0x5F,

.

        SLEEP = 95,

.

    SYSTEM_POWER_STATE MinSleepAc;

.

    SYSTEM_POWER_STATE MinSleepDc;

.

    SYSTEM_POWER_STATE ReducedLatencySleepAc;

.

    SYSTEM_POWER_STATE ReducedLatencySleepDc;

.

        Private MinSleepAc As SYSTEM_POWER_STATE

.

        Private MinSleepDc As SYSTEM_POWER_STATE

.

        Private ReducedLatencySleepAc As SYSTEM_POWER_STATE

.

        Private ReducedLatencySleepDc As SYSTEM_POWER_STATE

.

   PowerActionSleep,      // Sleep.

.

   POWER_ACTION_LIGHTEST_FIRST = 0x10000000, // Uses the first lightest available sleep state.

.

   PowerActionSleep       ' Sleep.

.

   POWER_ACTION_LIGHTEST_FIRST = 0x10000000  ' Uses the first lightest available sleep state.

.

    public bool SleepButtonPresent;

.

    PowerSystemSleeping1 = 2,

.

    PowerSystemSleeping2 = 3,

.

    PowerSystemSleeping3 = 4,

.

    PowerSystemSleeping1 = 2

.

    PowerSystemSleeping2 = 3

.

    PowerSystemSleeping3 = 4

.

            public SYSTEM_POWER_STATE MaxSleepAc;

.

            public SYSTEM_POWER_STATE MaxSleepDc;

.

        Public MaxSleepAc As SYSTEM_POWER_STATE

.

        Public MaxSleepDc As SYSTEM_POWER_STATE

user32

.

        System.Threading.Thread.Sleep(10);

.

            Thread.Sleep(1000);

.

                VK_SLEEP = 0x5F,

.

    VK_SLEEP     = 0x5F,

.

Test it with: sleep 15; ./a.exe

.
Note
WaitForInputIdle (Warning this will only wait once! See Raymond Chen's Blog Post http://blogs.msdn.com/b/oldnewthing/archive/2010/03/25/9984720.aspx ), or a Sleep may be required to assure Window is ready for input:
.

  Sleep(2000,0)

.

         Thread.Sleep(100);

.

     Thread.Sleep(100)

.

            Thread.Sleep(1000);

.

            Thread.Sleep(1000);

.

            Thread.Sleep(1000);

.

            Thread.Sleep(1000);

.

         Thread.Sleep(100);

.

     Thread.Sleep(100)

.

        Thread.Sleep(2000);

.

   Thread.Sleep(2500);

.

   Start-Sleep 2 ; [Testing.Windows3]::SendInput($_inputArray.count, $_inputArray, [Runtime.InteropServices.marshal]::SizeOf($_inputArray[0]))

.

                System.Threading.Thread.Sleep(500);

.

    Thread.Sleep(1000);

.

         Thread.Sleep(100);

.

     Thread.Sleep(100)

.

Threading.Thread.Sleep(5000) 'Wait 5 Seconds

.

    public const uint VK_SLEEP = 0x5F;

ole32

.

        System.Threading.Thread.Sleep((int)pause);

.

        System.Threading.Thread.Sleep((int)pause);

coredll

.

    D3 = 3, // Sleep: partially powered with device initiated wake

.

D3, // Sleep: partially powered with device initiated wake

.

To keep a device awake indefinitely, you can use SystemParametersInfo() (also in CoreDll) to query the three idle timeouts SPI_GETBATTERYIDLETIMEOUT, SPI_GETEXTERNALIDLETIMEOUT, and SPI_GETWAKEUPIDLETIMEOUT. Ignoring any values that are zero, use the minimum of these three values as your N, set a recurring timer to fire more often than every N seconds, and call SystemIdleTimerReset() every time it fires. When you're done with your critical operation, kill the timer, and the device will be able to sleep again. I tried this from C# and each idle-timeout value was 0, so I just called SystemIdleTimerReset() every 30 seconds during the critical operation.

.

    private static int nDisableSleepCalls = 0;

.

    private static System.Threading.Timer preventSleepTimer = null;

.

    public static void DisableDeviceSleep()

.

        nDisableSleepCalls++;

.

        if (nDisableSleepCalls == 1)

.

            Debug.Assert(preventSleepTimer == null);

.

            preventSleepTimer = new System.Threading.Timer(new TimerCallback(PokeDeviceToKeepAwake),

.

    public static void EnableDeviceSleep()

.

        nDisableSleepCalls--;

.

        if (nDisableSleepCalls == 0)

.

            Debug.Assert(preventSleepTimer != null);

.

            if (preventSleepTimer != null)

.

                preventSleepTimer.Dispose();

.

                preventSleepTimer = null;

kernel32

.

            System.Threading.Thread.Sleep(dataRead ? 50 : 1000);

.

            System.Threading.Thread.Sleep(1000);

.

        status = "Disk is sleeping";

.

     Thread.Sleep(1000);

.

            // Optional - Sleep for a bit...

.

            // Thread.Sleep(10);

.

         System.Threading.Thread.Sleep(1000);

.

Sleep(5);

.

Setting a flag without also using ES_CONTINUOUS merely resets the idle timer, so it does not prevent sleep for an extended period.

.

    void PreventSleep ()

.

        // Prevent Idle-to-Sleep (monitor not affected) (see note above)

36: Sleep
.
Summary
Stop processing (sleep process) for specified number of miliseconds
.

static extern void Sleep(uint dwMilliseconds);

.

Public Sub Sleep(MilliSeconds As UInteger)

.

Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

.

This allows you to call 'Sleep(INT)' and force your application to sleep INT milliseconds.

.

static extern void Sleep(uint dwMilliseconds);

.

    Sleep(U2000);  // pause for two seconds

.

    System.Threading.Thread.Sleep(2000); // does the same thing

.

Public Sub Sleep(MilliSeconds As UInteger)

.

    Sleep(2000)  ' pause for two seconds

.

    System.Threading.Thread.Sleep(2000) ' does the same thing

.

Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

.

Sleep 1000

.

System.Threading.Thread.Sleep()

.
Documentation

Enums

.

            PowerActionSleepPowerActionSleep,

.

   PowerSystemSleeping1PowerSystemSleeping1 = 2,

.

   PowerSystemSleeping2PowerSystemSleeping2 = 3,

.

   PowerSystemSleeping3PowerSystemSleeping3 = 4,

.

        Sleep = 0x5F,

.

    VK_SLEEP = &H5F         ' // [Sleep] = 095

40: VK
.

        ///Computer Sleep key

.

        SLEEP = 0x5F,

.

    SLEEP = 95

powrprof

.

    /// Check out if there is a sleep botton present in the system.

.

    public static bool SleepButtonPresent

.

        return systemPowerCapabilites.SleepButtonPresent;

.

        /// The device supports system sleep state S0.

.

        /// The device supports system sleep state S1.

.

        /// The device supports system sleep state S2.

.

        /// The device supports system sleep state S3.

.

        /// The device supports system sleep state S4.

.

        /// The device supports system sleep state S5.

.

        /// The device supports waking from system sleep state S0.

.

        /// The device supports waking from system sleep state S1.

.

        /// The device supports waking from system sleep state S2.

.

        /// The device supports waking from system sleep state S3.

.

        /// Check whether the device is currently enabled to wake the system from a sleep state.

.

    namespace Sleeper

.

            /// Suspends the system by shutting power down. Depending on the Hibernate parameter, the system either enters a suspend (sleep) state or hibernation (S4).

.

                // Sleeps the machine

advapi32

.

        D3, // Sleep: partially powered with device initiated wake

.

    D3 'Sleep: partially powered with device initiated wake


 
Access PInvoke.net directly from VS: