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]

ole32

.

static extern void CoCancelCall(uint dwThreadID, uint ulTimeout);

.
Summary
Converts the MS-DOS representation of the time and date to a FILETIME structure.
.

static extern bool CoDosDateTimeToFileTime(

.

   ushort nDosTime,

.

   out FILETIME lpFileTime);

.
Documentation
[CoDosDateTimeToFileTime] on MSDN
.
Summary
Returns the current time as a FILETIME structure.
.

static extern void CoFileTimeNow(out FILETIME time);

.

FILETIME, which is defined in [System.Runtime.InteropServices] or [System.Runtime.InteropServices.ComTypes] in the .NET Framework 2.0.

.

You cannot define FILETIME as the return type, because the marshaler does not support it.

.

[System.DateTime.Now]

.
Documentation
[CoFileTimeNow] on MSDN
.
Summary
Converts a FILETIME into MS-DOS date and time values.
.

static extern bool CoFileTimeToDosDateTime(

.

   [In] ref FILETIME lpFileTime,

.

   out ushort lpDosTime);

.

FILETIME, which is defined in [System.Runtime.InteropServices] or [System.Runtime.InteropServices.ComTypes] in the .NET Framework 2.0.

.
Documentation
[CoFileTimeToDosDateTime] on MSDN
.

     unloadDelay - The delay in milliseconds between the time that the DLL

.

     unloadDelay - The delay in milliseconds between the time that the DLL

.

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

.
Summary
CoInitializeEx initializes the COM library for use by the calling thread, sets the thread's concurrency model, and creates a new apartment for the thread if one is required. Values for the dwCoInit parameter are taken from the COINIT enumeration. However, since pinvoke is a dotNET construct you should be aware that dotNET already does a COM initialization and therefore calling a CoInitializeEx function most likely will not do what you expect. This problem occurs when trying to instantiate a COM object from within dotNET where the COM objects threading model is different from dotNETs. Search on Common Language Runtime or CLR and COINIT_APARTMENTTHREADED to find posts on this issue.
.

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

.

Marshal.FreeCoTaskMem http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.freecotaskmem.aspx

.

static extern int CoUnmarshalInterface(System.Runtime.InteropServices.ComTypes.IStream pStm, [In] ref Guid riid,

.

static extern int CoWaitForMultipleHandles(uint dwFlags, uint dwTimeout,

.

The managed definition for the IMoniker interface is available in System.Runtime.InteropServices.ComTypes

.

As of .NET 2.0, UCOMIMoniker is obsolete and has been replaced with System.Runtime.InteropServices.ComTypes.IMoniker. This extends to all interfaces of the System.Runtime.InteropServices namespace starting with "UCOM...". Each of them are replaced in the System.Runtime.InteropServices.ComTypes namespace, with same name, except for the "UCOM" at the beginning.

.

   out System.Runtime.InteropServices.ComTypes.IMoniker ppmk);

.

For .Net 2.0, use System.Runtime.InteropServices.ComTypes.IMoniker as the final parameter; frameworks 1.0 and 1.1 use System.Runtime.InteropServices.UCOMIMoniker.

.

As of .NET 2.0, UCOMIMoniker is obsolete and has been replaced with System.Runtime.InteropServices.ComTypes.IMoniker. This extends to all interfaces of the System.Runtime.InteropServices namespace starting with "UCOM...". Each of them are replaced in the System.Runtime.InteropServices.ComTypes namespace, with same name, except for the "UCOM" at the beginning.

.

   punk, out System.Runtime.InteropServices.ComTypes.IMoniker ppmk);

.

       [System.Runtime.InteropServices.DllImport("OLE32.DLL", EntryPoint = "CreateStreamOnHGlobal")] // Create a COM stream from a pointer in unmanaged memory

.

    extern public static int CreateStreamOnHGlobal(IntPtr ptr, bool delete, out System.Runtime.InteropServices.ComTypes.IStream pOutStm);

.

    [System.Runtime.InteropServices.DllImport("OLE32.DLL", EntryPoint = "GetHGlobalFromStream")]

.

       out System.Runtime.InteropServices.ComTypes.IRunningObjectTable pprot);

.

In .Net 2.0 use System.Runtime.InteropServices.ComTypes.IRunningObjectTabl as the second parameter. Frameworks 1.0 and 1.1 use a now deprecated type.

.

     System.Runtime.InteropServices.ComTypes.IRunningObjectTable objTbl;

. .

I find it better to turn off [PreserveSig] for methods that return an HRESULT and have a trailing out parameter, providing that the HRESULT does not have more that one success code (typically S_OK only). This results in a slightly cleaner syntax where the out parameter becomes the return value and a failing HRESULT results in an exception.

.

using System.Runtime.Interop;

.

using System.Runtime.InteropServices;

. .

I find it better to turn off [PreserveSig] for methods that return an HRESULT and have a trailing out parameter, providing that the HRESULT does not have more that one success code (typically S_OK only). This results in a slightly cleaner syntax where the out parameter becomes the return value and a failing HRESULT results in an exception.

.

using System.Runtime.Interop;

.

static extern int OleLoadFromStream(System.Runtime.InteropServices.ComTypes.IStream pStm,

.

static extern int OleLoadFromStream(System.Runtime.InteropServices.ComTypes.IStream pStm,

.

      [System.Runtime.InteropServices.DllImport("OLE32.DLL", EntryPoint = "CreateStreamOnHGlobal")]

.

    extern public static int CreateStreamOnHGlobal(IntPtr ptr, bool delete, out System.Runtime.InteropServices.ComTypes.IStream pOutStm);

.

        System.Runtime.InteropServices.ComTypes.STATSTG fileinfo;

.

    [System.Runtime.InteropServices.DllImport("OLE32.DLL", EntryPoint = "CreateStreamOnHGlobal")]

.

    extern public static int CreateStreamOnHGlobal(IntPtr ptr, bool delete, out System.Runtime.InteropServices.ComTypes.IStream pOutStm);

.

        System.Runtime.InteropServices.ComTypes.STATSTG fileinfo;

.

Public Shared Function OleSetClipboard(ByVal pDataObj As System.Runtime.InteropServices.ComTypes.IDataObject) As Int32

. .

I find it better to turn off [PreserveSig] for methods that return an HRESULT and have a trailing out parameter, providing that the HRESULT does not have more that one success code (typically S_OK only). This results in a slightly cleaner syntax where the out parameter becomes the return value and a failing HRESULT results in an exception.

.

using System.Runtime.Interop;

uxtheme

.

The System.Windows.Forms.VisualStyles namespace allows rendering of various Visual Style elements, which sometimes can be cumbersome if you have alot of elements to work with or just want to keep the code to a minimal (or are on the design team and not the code team). Or you can get the freeware .NET component to place VisualStyleElement parts in the IDE forms designer using the VisualStyleRenderer .NET control. You can

winhttp

.

/// <returns>If the function succeeds, the function returns <c>true</c>. If the function fails, it returns <c>false</c>. For extended error data, call <see cref="System.Runtime.InteropServices.Marshal.GetLastWin32Error"/>.</returns>

.

static extern bool WinHttpSetTimeouts(

.

            int dwResolveTimeout,

.

            int dwConnectTimeout,

.

            int dwSendTimeout,

.

            int dwReceiveTimeout

.

Declare Function WinHttpSetTimeouts Lib "winhttp.dll" (ByVal hInternet As IntPtr, ByVal dwResolveTimeout As Integer, ByVal dwConnectTimeout As Integer, ByVal dwSendTimeout As Integer, ByVal dwReceiveTimeout As Integer) As Boolean

.
Documentation
[WinHttpSetTimeouts] on MSDN

netapi32

.

    DS_TIMESERV_REQUIRED = 0x00000800,

.

    DS_GOOD_TIMESERV_PREFERRED = 0x00002000,

.

Declare Function NetDfsAdd Lib "NETAPI32.DLL" (<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> ByVal DfsEntryPath As String, <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> ByVal ServerName As String, <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> ByVal ShareName As String, <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> ByVal Comment As String, ByVal Flags As Uint32) As Long

.

    Declare Function NetDfsRemove Lib "NETAPI32.DLL" (<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> _

.

  ByVal DfsEntryPath As String, <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> _

.

  ByVal ServerName As String, <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> _

.

Imports System.Runtime.InteropServices

.

    using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

Add 'private const uint MAX_PREFERRED_LENGTH = 4294967294;' to the defines and request 100 records at a time thus:

.

        uint reqRecs = 100; // Number of records to get (Win2K+ only allows 100 at a time)

.
Summary
Returns the time of day information from a specified server.
.

using System.Runtime.InteropServices;

.

        public struct structTIME_OF_DAY_INFO

.

                public int itod_timezone;

.

            structTIME_OF_DAY_INFO result = new structTIME_OF_DAY_INFO();

.

            // Get the time of day.

.

            result = (structTIME_OF_DAY_INFO)Marshal.PtrToStructure(pintBuffer, typeof(structTIME_OF_DAY_INFO));

.

                TOD_INFO[6]  = result.itod_timezone;

.

using System.Runtime.InteropServices;

.

            Console.Write("\r\nDate/Time from {0} : {1}.{2}.{3}  {4}:{5}:{6} TZ = {7}\r\n",

.

If you need to get the time from a domain controller:

.

        Console.WriteLine(c.CurrentTime);

.

    /// Time the job is run. Expressed in milliseconds from midnight of the day the

.

    public uint JobTime;

.

using System.Runtime.InteropServices;

.

            TimeSource= 0x00000020,

.

            [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]

.

            [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]

.

            [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]

.

namespace System.Runtime.InteropServices

.

using System.Runtime.InteropServices;

.

            SV_TYPE_TIME_SOURCE= 0x00000020,

.

            [MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)]

.

            [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]

.

            [MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)] public UInt32 sv101_version_major;

.

            [MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)] public UInt32 sv101_version_minor;

.

            [MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)] public UInt32 sv101_type;

.

            [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] public string sv101_comment;

.

    TimeSource= 0x00000020,

.

    [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]

.

    ''' <item>10 - Return the name of the computer, name of the user, and active and idle times for the session. The bufptr parameter points to an array of SESSION_INFO_10 structures. </item>

.

        public uint sesi502_time;

.

        public uint sesi502_idle_time;

.

        /// Unable to contact resource. Connection timed out.

.

    Public sesi502_time As UInt32

.

    Public sesi502_idle_time As UInt32

.

Imports System.Runtime.InteropServices

.

  Imports System.Runtime.InteropServices

.

    using System.Runtime.InteropServices;

.

// I found the following at http://www.codeproject.com/KB/cs/GetLastRebootTime.aspx by Gautham Jayaraman

.

  DateTime aRebootTime = DateTime.FromFileTime(wks.StatisticsStartTime);

.

  System.Console.WriteLine(aRebootTime);

.

using System.Runtime.InteropServices;

.

Imports System.Runtime.InteropServices

.

Imports System.Runtime.InteropServices.UnmanagedType

.

Imports System.Runtime.InteropServices.Marshal

.

Imports System.Runtime.InteropServices.StructLayoutAttribute

.

        using System.Runtime.InteropServices;

.

        using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

Shared Function NetWkstaUserEnum(ByVal servername As String, ByVal level As Integer, <System.Runtime.InteropServices.Out()> ByRef bufptr As IntPtr, ByVal prefmaxlen As Integer, <System.Runtime.InteropServices.Out()> ByRef entriesread As Integer, <System.Runtime.InteropServices.Out()> ByRef totalentries As Integer, ByRef resume_handle As Integer) As Integer

.

    [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]

.

    [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]

.

    [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]

.

    [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]

.

        public Int64 StatisticsStartTime;

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)

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


 
Access PInvoke.net directly from VS: