Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / January 2004

Tip: Looking for answers? Try searching our database.

OpenEvent(...)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Owe Armandt - 07 Jan 2004 21:24 GMT
I was using an event between to apps in Win32, one creating a named event
(like CreateEvent(NULL, FALSE, FALSE, "EVENTNAME"); ) and the other doing
OpenEvent(EVENT_ALL_ACCESS, TRYUE, "EVENTNAME");. This way one app could
signal the other in a convinient way.

Now one of the apps will be .NET, the one that will do the OpenEvent(..),
the problem is I cannot find out how to do the OpenEvent(...) bit.

Anybody knows???

Owe Armandt
Mattias Sj?gren - 08 Jan 2004 02:46 GMT
Owe,

>Now one of the apps will be .NET, the one that will do the OpenEvent(..),
>the problem is I cannot find out how to do the OpenEvent(...) bit.
>
>Anybody knows???

[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
static extern IntPtr OpenEvent(uint dwDesiredAccess, bool
bInheritHandle, string lpName);

[DllImport("kernel32.dll")]
static extern bool CloseHandle(IntPtr hObject);

const uint EVENT_ALL_ACCESS = 0x1F0003;

...

IntPtr hEvent = OpenEvent(EVENT_ALL_ACCESS, true, "EVENTNAME");
... use event ...
CloseHandle(hEvent);

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Owe Armandt - 10 Jan 2004 14:33 GMT
So you mean there is no .NET way of doing this other than using unmanaged
code by importing the functions like this??

Owe

> Owe,
>
[quoted text clipped - 24 lines]
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
"Ying-Shen Yu[MSFT]" - 13 Jan 2004 02:44 GMT
Hi Owe,

If you want to sync with other unmanaged apps, PInvoke is needed, since as
I know .NET does not provide a way to create/open a named event.
If you want to sync with managed apps, it might be better to use some other
mechanism, such as .NET Remoting.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed before
sending.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.