Desktop Functions: Smart Device Functions:
|
Search Results for "time" in [All]dbghelp
string dumpFileName = assemblyPath + "_" + DateTime.Now.ToString("dd.MM.yyyy.HH.mm.ss") + ".dmp"; 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;
[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());
[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
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.
static extern UInt32 timeGetSystemTime( ref MmTime mmTime, UInt32 sizeMmTime );
Declare Function timeGetSystemTime Lib "winmm.dll" (TODO) As TODO 8: timeGetTime
[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
static extern UInt32 timeKillEvent( UInt32 timerEventId );
Declare Function timeKillEvent Lib "winmm.dll" (TODO) As TODO 10: timeSetEvent
static extern UInt32 timeSetEvent( UInt32 msDelay, UInt32 msResolution,
TimerEventHandler handler, ref UInt32 userCtx, UInt32 eventType );
Declare Function timeSetEvent Lib "winmm.dll" (TODO) As TODO 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());
<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; msi
using System.Runtime.InteropServices; using System.Runtime.InteropServices; urlmon15: CopyMemory
Console.WriteLine("Total time to copy {0:N0} bytes = {1}", new TimeSpan(sw.ElapsedTicks)) user32- The foreground lock time-out has expired (see SPI_GETFOREGROUNDLOCKTIMEOUT in SystemParametersInfo). 17: AnimateWindow
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 18: ClipCursor
[System.Runtime.InteropServices.DllImport("user32.dll")] 19: CloseClipboard by using the 3 clipboard API's below first it work every time and you don't have to 20: CopyIcon CopyCursor reference will fail at runtime, according to documentation it is a macro: 21: CreateCaret
SetCaretBlinkTime(300) 22: CreateDesktop 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 23: CreatePopupMenu
[System.Runtime.InteropServices.ComRegisterFunctionAttribute()]
[System.Runtime.InteropServices.ComUnregisterFunctionAttribute()] 24: CreateWindowEx 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, 26: DestroyWindow
/// <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> 27: DragDetect
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)] 29: DrawMenuBar
[System.Runtime.InteropServices.DllImport("user32.dll")]
[System.Runtime.InteropServices.DllImport("user32.dll")]
[System.Runtime.InteropServices.DllImport("user32.dll")]
[System.Runtime.InteropServices.DllImport("user32.dll")] 30: EnableMenuItem
<DllImport("user32.dll", CallingConvention:=Runtime.InteropServices.CallingConvention.Cdecl)> _
<DllImport("user32.dll", CallingConvention:=Runtime.InteropServices.CallingConvention.Cdecl)> _ 31: EnumChildWindows
Imports System.Runtime.InteropServices
using System.Runtime.InteropServices; 33: EnumDesktops
<Runtime.InteropServices.DllImport("user32.dll")>
using System.Runtime.InteropServices; using System.Runtime.InteropServices; Imports System.Runtime.InteropServices 36: FlashWindow
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) 37: FlashWindowEx
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) 38: GetAsyncKeyState
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
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; 41: GetComboBoxInfo
cbi.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(cbi);
cbi.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(cbi) 42: GetCursor
<System.Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)> _
using System.Runtime.InteropServices; 43: GetCursorPos
<System.Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)> _
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) 45: GetGUIThreadInfo
using System.Runtime.InteropServices; 46: GetIconInfo
<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
using System.Runtime.InteropServices; 48: GetKeyboardState
using System.Runtime.InteropServices;
using System.Runtime.InteropServices; Imports System.Runtime.InteropServices
using System.Runtime.InteropServices; 49: GetKeyState 50: GetLastError
Use Runtime.InteropServices.Marshal.GetLastWin32Error() 51: GetLastInputInfo
dwTime : uint32 Compare to Environment.TickCount to get the time since the last user input. These samples do not take into account the rollover of the tick counter which will occur after ~50 days of uptime. This function retrieves the time in seconds since last user input
static uint GetLastInputTime()
uint idleTime = 0;
lastInputInfo.dwTime = 0;
uint lastInputTick = lastInputInfo.dwTime;
idleTime = envTicks - lastInputTick;
return (( idleTime > 0 ) ? ( idleTime / 1000 ) : 0); This function retrieves the time in seconds since last user input
Dim idletime As Integer
Public Function GetLastInputTime() As Integer
idletime = 0
lastInputInf.dwTime = 0
idletime = Environment.TickCount - lastInputInf.dwTime
If idletime > 0 Then
Return idletime / 1000 This function retrieves the time in seconds since last user input
public: static double getSystemIdleTime()
int systemUptime = Environment::TickCount;
lastInputInfo.dwTime = 0;
int lastInputTicks = (int)lastInputInfo.dwTime;
idleTicks = systemUptime - lastInputTicks;
let idleTimeSeconds() =
let mutable info = { size = size; dwTime = 0u }
let idleTicks = now - info.dwTime Prints time in seconds since last user input.
int systemUptime = GetTickCount(); // was Environment.TickCount
lastInputInfo.dwTime = 0;
int lastInputTicks = (int)lastInputInfo.dwTime;
idleTicks = systemUptime - lastInputTicks; 52: GetMenuItemCount
[System.Runtime.InteropServices.DllImport("user32.dll")]
[System.Runtime.InteropServices.DllImport("user32.dll")]
[System.Runtime.InteropServices.DllImport("user32.dll")]
[System.Runtime.InteropServices.DllImport("user32.dll")] 53: GetMessageTime
public int time ; //Specifies the time stamp of the mouse coordinate 55: GetQueueStatus
QS_TIMER = 0x0010,
QS_ALLEVENTS = (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY),
QS_ALLINPUT = (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY | QS_SENDMESSAGE) 56: GetSystemMenu
[System.Runtime.InteropServices.DllImport("user32.dll")]
[System.Runtime.InteropServices.DllImport("user32.dll")]
[System.Runtime.InteropServices.DllImport("user32.dll")]
[System.Runtime.InteropServices.DllImport("user32.dll")] 57: GetThreadDesktop
Imports System.Runtime.InteropServices
Imports System.Runtime.InteropServices 59: GetWindowDC
wpTemp.Length = System.Runtime.InteropServices.Marshal.SizeOf(wpTemp) Cut off search results after 60. Please refine your search. |