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 / New Users / December 2004

Tip: Looking for answers? Try searching our database.

How to do SetEvent/CreateEvent in VB .Net

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
M K - 22 Dec 2004 17:27 GMT
I have this C++ code I'm trying to port to VB .Net:
 HANDLE g_hImageReady = NULL; // Event for when image is ready to transfer
 //
 // Initialize the globals
 //
 g_hImageReady = CreateEvent(NULL, TRUE, FALSE, NULL);
 if(g_hImageReady == NULL)
 {
  printf("Unable to create image ready event. Exiting...\n");
  continue;
 }

And later:
if( (inEvent == KPDCAddFile) || (inEvent == KPDCFolderContent) )
{
 SetEvent(g_hImageReady);
}

The CreateEvent and SetEvents are what I need to replicate. I'm not sure
exactly what they are used for and what their equivelent would be. I have
done delegates in VB .Net. Is this related?
David Browne - 22 Dec 2004 19:14 GMT
>I have this C++ code I'm trying to port to VB .Net:
>  HANDLE g_hImageReady = NULL; // Event for when image is ready to transfer
[quoted text clipped - 17 lines]
> exactly what they are used for and what their equivelent would be. I have
> done delegates in VB .Net. Is this related?

see
 System.Threading.ManualResetEvent
and
 System.Threading.AutoResetEvent

David
M K - 22 Dec 2004 19:51 GMT
I'm thinking you're on to something. Okay, here is more of my issue. (I have
a post on channel9. http://channel9.msdn.com/ShowPost.aspx?PostID=33171)

I have a form with an instance of a class (DCSIntf). DCSIntf wraps unmanaged
code. The unmanaged code calls a function in DCSIntf on certain events. My
function in DCSIntf raises an event that is handled by my form. The function  
in DCSIntf fires, but only once. The subsequent calls don't fire until my
form closes. By then the wrapper class is GC'd so the unmanaged calls error.
M K - 22 Dec 2004 20:31 GMT
So, do I do:
Private g_hImageReady as ManualResetEvent
g_hImageReady = new ManualResetEvent(False)

?

Please, I'm down to the wire... this is the last piece.
M K - 22 Dec 2004 23:41 GMT
I'm not sure what to do with what you said. It seems like it would help, but
this is a new concept. Any help would be greatly appreciated, as the deadline
for this project is tomorrow.

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.