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 "time" in [All]

winscard

.

    /// <param name="dwTimeout">The maximum amount of time, in milliseconds, to wait for an action. A value of zero causes the function to return immediately. A value of INFINITE causes this function never to time out.</param>

.

static extern SCardFunctionReturnCodes SCardGetStatusChange(int hContext, int dwTimeout, [In, Out] SCARD_READERSTATE[] rgReaderStates, int cReaders);

.

    SCARD_E_TIMEOUT =           0x8010000A,

.
Summary
The SCardStatus function provides the current status of a smart card in a reader. You can call it any time after a successful call to SCardConnect and before a successful call to SCardDisconnect. It does not affect the state of the reader or reader driver.
.

        request.cbPciLength = System.Runtime.InteropServices.Marshal.SizeOf(typeof(UnsafeNativeMethods.SCARD_IO_REQUEST));

.

    internal static extern uint SCardGetStatusChange(IntPtr hContext, UInt32 dwTimeout, [In, Out] SCARD_READERSTATE[] rgReaderStates, UInt32 cReaders);

odbc32

.

<Runtime.InteropServices.DllImport("odbc32.dll", CharSet:=Runtime.InteropServices.CharSet.Unicode)> _

.

    Private Shared Function SQLAllocStmt(ByVal connectionHandle As IntPtr, <Runtime.InteropServices.Out()> _

.

<Runtime.InteropServices.DllImport("odbc32.dll", CharSet:=Runtime.InteropServices.CharSet.Unicode)> _

.

<Runtime.InteropServices.DllImport("odbc32.dll", CharSet:=Runtime.InteropServices.CharSet.Unicode)> _

.

    <Runtime.InteropServices.Out()> ByRef pbcConnStrOut As Short, ByVal fDriverCompletion As Short) As Short

.

<Runtime.InteropServices.DllImport("odbc32.dll", CharSet:=Runtime.InteropServices.CharSet.Unicode)> _

.

<Runtime.InteropServices.DllImport("odbc32.dll", CharSet:=Runtime.InteropServices.CharSet.Unicode)> _

.

<Runtime.InteropServices.DllImport("odbc32.dll", CharSet:=Runtime.InteropServices.CharSet.Unicode)> _

.

<Runtime.InteropServices.DllImport("odbc32.dll")> _

.

<Runtime.InteropServices.DllImport("odbc32.dll", CharSet:=Runtime.InteropServices.CharSet.Unicode)> _

winmm

.

Declare Function midiStreamPosition Lib "winmm.dll" (ByVal hms As IntPtr, ByVal pmmt As MMTIME, ByVal cbmmt As UInteger) As Integer

.

Structure MMTIME

.

   using System.Runtime.InteropServices;

.
Summary
The timeBeginPeriod function sets the minimum timer resolution for an application or device driver. Used to manipulate the timer frequency.
.

[DllImport("winmm.dll", EntryPoint="timeBeginPeriod")]

.

Declare Function timeBeginPeriod Lib "winmm.dll" (ByVal uPeriod As Integer) As Integer

.

Also see TimeGetTime (MM_GetTime) and TimeEndPeriod (MM_EndPeriod)

.

  MM_BeginPeriod(1); // set timer resolution to 1ms => freq=1000Hz

.

    // tickcount has resolution of 16.5ms, mmtime has 1ms

.

      oWriter.WriteLine("{0}: TickCount={1}, MMTime={2}", nLoop, Environment.TickCount, MM_GetTime());

.
Documentation
[timeBeginPeriod] on MSDN
.
Summary
The timeEndPeriod function clears a previously set minimum timer resolution
.

[DllImport("winmm.dll", EntryPoint="timeEndPeriod")]

.

Declare Function timeEndPeriod Lib "winmm.dll" (ByVal uPeriod As Integer) As Integer

.

Also see timeBeginPeriod and timeEndPeriod

.

See timeBeginPeriod for a sample

.
Documentation
[timeEndPeriod] on MSDN
.
Summary
The timeGetDevCaps function queries the timer device to determine its resolution.
.

static extern UInt32 timeGetDevCaps( ref TimeCaps timeCaps,

.

            UInt32 sizeTimeCaps );

.

Declare Function timeGetDevCaps Lib "winmm.dll" (ByRef lpTimeCaps As TimeCaps, ByVal uSize As UInt32) As UInt32

.

http://www.pinvoke.net/default.aspx/Structures.TimeCaps

.

Returns TIMERR_NOERROR if successful or TIMERR_STRUCT if it fails to return the timer device capabilities.

.

TIMERR_NOERROR is defined as UInt32 0 value.

.
Documentation
[timeGetDevCaps] on MSDN
.

static extern UInt32 timeGetSystemTime( ref MmTime mmTime, UInt32 sizeMmTime );

.

Declare Function timeGetSystemTime Lib "winmm.dll" (TODO) As TODO

.
Documentation
[timeGetSystemTime] on MSDN
.
Summary
The timeGetTime function retrieves the system time, in milliseconds. The system time is the time elapsed since Windows was started.
.

[DllImport("winmm.dll", EntryPoint="timeGetTime")]

.

public static extern uint MM_GetTime();

.

<DllImport("winmm.dll", EntryPoint := "timeGetTime")> _

.

Public Shared Function MM_GetTime() As UInteger

.

Unlike Environment.TickCount, you can directly set the resolution of this timer with the TimeBeginPeriod function.

.

See TimeBeginPeriod (imported as MM_BeginPeriod) and TimeEndPeriod (imported as MM_EndPeriod)

.

See TimeBeginPeriod for a sample

.
Documentation
[timeGetTime] on MSDN
.

static extern UInt32 timeKillEvent( UInt32 timerEventId );

.

Declare Function timeKillEvent Lib "winmm.dll" (TODO) As TODO

.
Documentation
[timeKillEvent] on MSDN
.

static extern UInt32 timeSetEvent( UInt32 msDelay, UInt32 msResolution,

.

            TimerEventHandler handler, ref UInt32 userCtx, UInt32 eventType );

.

Declare Function timeSetEvent Lib "winmm.dll" (TODO) As TODO

.

TimerEventHandler

.

System.Threading.Timer

.

    public class MMTimer : IDisposable

.

    static extern uint timeSetEvent(uint uDelay, uint uResolution, TimerCallback lpTimeProc, UIntPtr dwUser, uint fuEvent);

.

    static extern uint timeKillEvent(uint uTimerID);

.

    static extern uint timeGetTime();

.

    static extern uint timeBeginPeriod(uint uPeriod);

.

    static extern uint timeEndPeriod(uint uPeriod);

.

    //Timer type definitions

.

        TIME_ONESHOT = 0,      //Event occurs once, after uDelay milliseconds.

.

        TIME_PERIODIC = 1,

.

        TIME_CALLBACK_FUNCTION = 0x0000,  /* callback is function */

.

        //TIME_CALLBACK_EVENT_SET = 0x0010, /* callback is event - use SetEvent */

.

        //TIME_CALLBACK_EVENT_PULSE = 0x0020  /* callback is event - use PulseEvent */

.

    delegate void TimerCallback(uint uTimerID, uint uMsg, UIntPtr dwUser, UIntPtr dw1, UIntPtr dw2);

.

    ~MMTimer()

.

    /// The current timer instance ID

.

    TimerCallback thisCB;

.

    /// The timer elapsed event

.

    public event EventHandler Timer;

.

    protected virtual void OnTimer(EventArgs e)

.

        if (Timer != null)

.

        Timer(this, e);

.

    public MMTimer()

.

    /// Stop the current timer instance (if any)

.

            timeKillEvent(id);

.

            Debug.WriteLine("MMTimer " + id.ToString() + " stopped");

.

    /// Start a timer instance

.

    /// <param name="ms">Timer interval in milliseconds</param>

.

        //Kill any existing timer

.

        //Set the timer type flags

.

        fuEvent f = fuEvent.TIME_CALLBACK_FUNCTION | (repeat ? fuEvent.TIME_PERIODIC : fuEvent.TIME_ONESHOT);

.

        id = timeSetEvent(ms, 0, thisCB, UIntPtr.Zero, (uint)f);

.

            throw new Exception("timeSetEvent error");

.

        Debug.WriteLine("MMTimer " + id.ToString() + " started");

.

    void CBFunc(uint uTimerID, uint uMsg, UIntPtr dwUser, UIntPtr dw1, UIntPtr dw2)

.

        //Callback from the MMTimer API that fires the Timer event. Note we are in a different thread here

.

        OnTimer(new EventArgs());

.
Documentation
[timeSetEvent] on MSDN
.

<Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential, CharSet:=Runtime.InteropServices.CharSet.Auto)> _

.

     <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=32)> _

.

[System.Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Auto)]

.

     [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 32)]

.

         waveOutGetDevCaps(i, wc, System.Runtime.InteropServices.Marshal.SizeOf(wc))  

.

using System.Runtime.InteropServices;

ipaqutil

.

No tips or tricks required, should work first time!

psapi

.

using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

      public uint PeakPagefileUsage;      // The peak value in bytes of the Commit Charge during the lifetime of this process (SIZE_T).

rpcrt4

.

pin_ptr<unsigned char> UuidSringPtr = static_cast<unsigned char *>(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi("C3ECE8CB-E9F8-47f9-AC61-8EA8572403F2").ToPointer());

.
System

user32

.

- The foreground lock time-out has expired (see SPI_GETFOREGROUNDLOCKTIMEOUT in SystemParametersInfo).

.

static extern bool AnimateWindow(IntPtr hwnd, int time, AnimateWindowFlags flags);

.

Imports System.Runtime.InteropServices

.

Shared Function AnimateWindow(ByVal hwnd As IntPtr, ByVal time As Integer, ByVal flags As AnimateWindowFlags) As Boolean

.

[System.Runtime.InteropServices.DllImport("user32.dll")]

.

by using the 3 clipboard API's below first it work every time and you don't have to

.

CopyCursor reference will fail at runtime, according to documentation it is a macro:

.

    SetCaretBlinkTime(300)

.

If you come across this error "System.Runtime.InteropServices.MarshalDirectiveException: Cannot marshal 'parameter #6': Invalid managed/unmanaged type combination (this value type must be paired with Struct).", you may want to use

.

        [System.Runtime.InteropServices.ComRegisterFunctionAttribute()]

.

        [System.Runtime.InteropServices.ComUnregisterFunctionAttribute()]

.

I sometimes get error 1407 ("Cannot find window class.") when trying to create the window (after a successful call to RegisterClass)

.

using System.Runtime.InteropServices;

.

   IntPtr hConv, IntPtr hszItem, uint wFmt, uint wType, uint dwTimeout,

.

/// <para>The DestroyWindow function destroys the specified window. The function sends WM_DESTROY and WM_NCDESTROY messages to the window to deactivate it and remove the keyboard focus from it. The function also destroys the window's menu, flushes the thread message queue, destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window is at the top of the viewer chain).</para>

.

''' <para>The DestroyWindow function destroys the specified window. The function sends WM_DESTROY and WM_NCDESTROY messages to the window to deactivate it and remove the keyboard focus from it. The function also destroys the window's menu, flushes the thread message queue, destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window is at the top of the viewer chain).</para>

.

    DateTime startTime = DateTime.Now;

.

    while ((DateTime.Now - startTime).TotalMilliseconds < 500) {

.

    [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]

.

    [System.Runtime.InteropServices.DllImport("user32.dll")]

.

      [System.Runtime.InteropServices.In] ref RECT lprcFrom,

.

      [System.Runtime.InteropServices.In] ref RECT lprcTo);

.

    [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]

.

    [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]

.

    [System.Runtime.InteropServices.DllImport("user32.dll")]

.

    [StructLayout(System::Runtime::InteropServices::LayoutKind::Sequential)]

.

    [System.Runtime.InteropServices.DllImport("user32.dll")]

.

    [System.Runtime.InteropServices.DllImport("user32.dll")]

.

    [System.Runtime.InteropServices.DllImport("user32.dll")]

.

    [System.Runtime.InteropServices.DllImport("user32.dll")]

.

    <DllImport("user32.dll", CallingConvention:=Runtime.InteropServices.CallingConvention.Cdecl)> _

.

    <DllImport("user32.dll", CallingConvention:=Runtime.InteropServices.CallingConvention.Cdecl)> _

.

Imports System.Runtime.InteropServices

.

using System.Runtime.InteropServices;

.

<Runtime.InteropServices.DllImport("user32.dll")>

.

using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

Imports System.Runtime.InteropServices

.

    public UInt32 dwTimeout;

.

    FLASHW_TIMER = 4,

.

    FLASHW_TIMERNOFG = 12

.

    fInfo.dwTimeout = 0;

.

        fInfo.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;

.

        fInfo.dwTimeout = 0;

.

    FLASHW_TIMER = 4

.

    FLASHW_TIMERNOFG = 12

.

    Public dwTimeout As Long

.

        If FlashCount = 0 Then .dwFlags = .dwFlags Or FlashWindowFlags.FLASHW_TIMERNOFG

.

        .dwTimeout = 0 ' Use the default cursor blink rate.

.

        .cbSize = System.Runtime.InteropServices.Marshal.SizeOf(fwi)

.

    public UInt32 dwTimeout;

.

    FLASHW_TIMER = 4,

.

    FLASHW_TIMERNOFG = 12

.

    fInfo.dwTimeout = 0;

.

        fInfo.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;

.

        fInfo.dwTimeout = 0;

.

    FLASHW_TIMER = 4

.

    FLASHW_TIMERNOFG = 12

.

    Public dwTimeout As Long

.

        If FlashCount = 0 Then .dwFlags = .dwFlags Or FlashWindowFlags.FLASHW_TIMERNOFG

.

        .dwTimeout = 0 ' Use the default cursor blink rate.

.

        .cbSize = System.Runtime.InteropServices.Marshal.SizeOf(fwi)

.

    private void timer1_Tick(object sender, EventArgs e)

.

        timer1.Interval = 3;

.

Imports System.Runtime.InteropServices

.

     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

.
Summary
.

static extern uint GetCaretBlinkTime();

.

Is there some Windows Message posted when the user changes the Blink Time in the system control ?

.

Use SystemInformation.CaretBlinkTime property

.

[GetCaretBlinkTime] on MSDN

.

using System.Runtime.InteropServices;

.

cbi.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(cbi);

.

cbi.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(cbi)

.

<System.Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)> _

.

using System.Runtime.InteropServices;

.

<System.Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)> _

.
Summary
.

static extern uint GetDoubleClickTime();

.

Declare Function GetDoubleClickTime Lib "user32.dll" () As Integer

.

System.Windows.Forms.SystemInformation.DoubleClickTime (http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.doubleclicktime.aspx)

.
Documentation
[GetDoubleClickTime] on MSDN
.

    using System.Runtime.InteropServices;

.

   <System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint:="GetIconInfo")>  _

.

    Public Shared Function GetIconInfo(ByVal hIcon As System.IntPtr, ByRef piconinfo As ICONINFO) As <System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)> Boolean

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: