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

coredll

.

        public static extern HANDLE CreateEvent(HANDLE lpEventAttributes, [In, MarshalAs(UnmanagedType.Bool)] bool bManualReset, [In, MarshalAs(UnmanagedType.Bool)] bool bIntialState, [In, MarshalAs(UnmanagedType.BStr)] string lpName);

.

            HANDLE p = CreateEvent(HANDLE.Zero, false, true, string.Empty);

.

public static extern HANDLE CreateEvent(HANDLE lpEventAttributes, [In, MarshalAs(UnmanagedType.Bool)] bool bManualReset, [In, MarshalAs(UnmanagedType.Bool)] bool bIntialState, [In, MarshalAs(UnmanagedType.BStr)] string lpName);

.

Declare Function CreateEvent Lib "coredll.dll" (ByVal lpEventAttributes As IntPtr, ByVal bManualReset As Boolean, ByVal bInitialStatre As Boolean, ByVal lpName As String) As IntPtr

.

        public static extern HANDLE CreateEvent(HANDLE lpEventAttributes, [In, MarshalAs(UnmanagedType.Bool)] bool bManualReset, [In, MarshalAs(UnmanagedType.Bool)] bool bIntialState, [In, MarshalAs(UnmanagedType.BStr)] string lpName);

.

            HANDLE p = CreateEvent(HANDLE.Zero, false, true, null);

.

    Public Shared Function CreateEvent(ByVal eventAttributes As IntPtr, <MarshalAs(UnmanagedType.Bool)> ByVal isManualReset As Boolean, <MarshalAs(UnmanagedType.Bool)> ByVal initialState As Boolean, <MarshalAs(UnmanagedType.BStr)> ByVal eventName As String) As IntPtr

.

        _handle = WaitHandles.CreateEvent(IntPtr.Zero, isManualResetEvent, initialState, name)

.
Documentation
[CreateEvent] on MSDN
.

        public static extern HANDLE CreateEvent(HANDLE lpEventAttributes, [In, MarshalAs(UnmanagedType.Bool)] bool bManualReset, [In, MarshalAs(UnmanagedType.Bool)] bool bIntialState, [In, MarshalAs(UnmanagedType.BStr)] string lpName);

.

                IntPtr p = CreateEvent(HANDLE.Zero, false, true, string.Empty);

.

The OpenEvent function enables multiple processes to open handles of the same event object. The function succeeds only if some process has already created the event using the CreateEvent function. The calling process can use the returned handle in any function that requires a handle to an event object, subject to the limitations of the access specified in the dwDesiredAccess parameter.

.

        public static extern HANDLE CreateEvent(HANDLE lpEventAttributes, [In, MarshalAs(UnmanagedType.Bool)] bool bManualReset, [In, MarshalAs(UnmanagedType.Bool)] bool bIntialState, [In, MarshalAs(UnmanagedType.BStr)] string lpName);

.

                IntPtr p = CreateEvent(HANDLE.Zero, false, true, string.Empty);

.

        public static extern HANDLE CreateEvent(HANDLE lpEventAttributes, [In, MarshalAs(UnmanagedType.Bool)] bool bManualReset, [In, MarshalAs(UnmanagedType.Bool)] bool bIntialState, [In, MarshalAs(UnmanagedType.BStr)] string lpName);

.

                IntPtr p = CreateEvent(HANDLE.Zero, false, true, null);

.

The Handle property of .NET EventWaitHandle objects are pseudo-handles, and cannot be used with this P/Invoke function. You can only use handles obtained from the CreateEvent P/Invoke function.

.

IntPtr hNamedEvent1 = CreateEvent(IntPtr.Zero, false, false, "namedEvent1");

.

IntPtr hNamedEvent2 = CreateEvent(IntPtr.Zero, false, false, "namedEvent2");

iphlpapi

.

    <DllImport("kernel32.dll", EntryPoint:="CreateEventA", CharSet:=CharSet.Unicode)>

.

    Public Shared Function CreateEvent(lpEventAttributes As IntPtr, ByVal bManualReset As Boolean, ByVal bInitialState As Boolean, ByVal lpName As String) As IntPtr

.

    pOverlapped.hEvent = CreateEvent(IntPtr.Zero, False, False, "enablerouter")

kernel32

.
Summary
.

     EntryPoint:="CreateEventA")> _

.

    Public Shared Function CreateEvent( _

.

static extern IntPtr CreateEvent(IntPtr lpEventAttributes, bool bManualReset, bool bInitialState, string lpName);

.

Tip 1: Use CreateEvent to create named event and attach it to AutoResetEvent class:

.

  are.Handle= handle; // handle from CreateEvent

.

IntPtr myEventHandle = CreateEvent(IntPtr.Zero, false, true, "MyEvent");

.

NOTE: This class needs some changes. The CloseHandle call will destroy the event when the last handle is closed. This makes it hard for one application to "lock" the event while making another wait on it since this class is always closing the handle. An alternative that I found to work is to have the CreateEvent call in the constructor and implement IDisposable by moving the CloseHandle call to the Dispose method.

.

    static extern IntPtr CreateEvent(IntPtr lpEventAttributes, bool bManualReset, bool bInitialState, string lpName);

.

        _Handle = CreateEvent( _Attributes, _ManualReset, _InitialState, _EventName );

.

        _Handle = CreateEvent( _Attributes, _ManualReset, _InitialState, _EventName );

.

        _Handle = CreateEvent( _Attributes, _ManualReset, _InitialState, _EventName );

.

        _Handle = CreateEvent( _Attributes, _ManualReset, _InitialState, _EventName );

.
Documentation
[CreateEvent] on MSDN
.

    throw new ApplicationException(string.Format("Error in pinvoked CreateEvent: {0}", le));

.

CreateEvent also opens an existing (named) event...


 
Access PInvoke.net directly from VS: