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 / Interop / February 2006

Tip: Looking for answers? Try searching our database.

Native event in C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Benny Tops - 23 Feb 2006 10:13 GMT
Hi guys,

I'm having a hard time to subscribe to a native event in C#.NET. The
application I'm writing should be able to detect changes in DHCP
parameters. This is done through the following:

DWORD  APIENTRY DhcpRegisterParamChange(
 DWORD Flags,
 LPVOID Reserved,
 LPWSTR AdapterName,
 LPDHCPCAPI_CLASSID pClassId,
 DHCPCAPI_PARAMS_ARRAY Params,
 LPVOID Handle
);

How do I tackle this? Do I have to use CreateEvent from kernel32.dll to
subscribe to this event? And how do I consume this event from managed
code (i.e. C#.NET)?

Thanks in advance,

Benny
Mattias Sjögren - 23 Feb 2006 21:06 GMT
Benny,

>How do I tackle this? Do I have to use CreateEvent from kernel32.dll to
>subscribe to this event?

From the usage examples at
http://msdn.microsoft.com/library/en-us/dhcp/dhcp/dhcp_client_api_examples.asp
it seems like you don't have to create the event object yourself,
rather it's returned by the API.

>And how do I consume this event from managed
>code (i.e. C#.NET)?

You can use the Wait APIs manually (like the sample code) or wrap it
in a managed WaitHandle.

Mattias

Signature

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


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.