Aneesh,
As of .NET 2.0, you don't need to use interop to get the handle to
named
events. You can call the static OpenExisting method to get a reference
to
an event which already exists and is named.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
On Jun 3, 11:53 am, (e-mail address removed) wrote:
Hi all,
I need to write app in C# that communicates with other app. I need to
use "named event" for that.
I should use windows APIs SetEvent() and WaitForSingleObject() etc...
I looked for help but couldn't find any.
Can any one please help me with that?
- Show quoted text -
Hello Nicholas,
thanks you and the other guys for your reply.
Can I use OpenExisting to sync with events set by app run from kernel
developed by C++?
Also, Is there a .NET way which replaces WIN API DeviceIoControl?
thanks.
Yes, you have to call OpenExisting to get access to the handle, of course
you will need appropriate access rights for this to scucceed.
DeviceIOControl is not covered by the FCL, so you will have to "PInvoke" the
API, following is the DllImport declaration for DeviceIoControl.
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
internal static extern int DeviceIoControl(SafeFileHandle handle, uint
dwIoControlCode, IntPtr lpInBuffer,
int nInBufferSize, IntPtr lpOutBuffer, int nOutBufferSize,
out int lpBytesReturned, IntPtr lpOverlapped);
Willy.