Event handling in VC++ 2005 .NET

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ben

    #1

    Event handling in VC++ 2005 .NET

    Hi

    I'm trying to setup a project that uses events. I'm creating a windows
    forms based application.

    The application interfaces to a DLL that controls a piece of external
    hardware, whenever an action occurs on the hardware it needs to signal
    my application.

    The DLL instructions tell me to use CreateEvent to make the event, I
    then pass the event handle to the DLL. This side of things seems to
    work correctly and comes back with no errors.

    What I'm having trouble with is how to tell the application to execute
    this event. The event needs to read the hardware and then return to
    the main program.

    I could use a timer and continually poll the hardware but as the
    hardware could signal at any time there is the danger I wouldn't be
    able to pick up the messages quickly enough.

    When an action is required the DLL uses SetEvent to signal the app.

    My event creation code is:
    (this is performed inside a button control on Form1)
    HANDLE hGlobalLDVEvent ;
    hGlobalLDVEvent =CreateEventW(N ULL,FALSE,FALSE ,TEXT("LDVEVENT "));
    hGlobalLDVEvent =OpenEventW(EVE NT_ALL_ACCESS,F ALSE,TEXT("LDVE VENT"));

    this returns with 0x268 which I believe this the event is properly
    created?

    What do I need to do now?

    Thanks for your help

    Ben
  • Mark Rae [MVP]

    #2
    Re: Event handling in VC++ 2005 .NET

    "Ben" <bcwyatt65@hotm ail.comwrote in message
    news:780657ae-2995-4d33-be3f-f19c5e12efe9@26 g2000hsk.google groups.com...
    I'm trying to setup a project that uses events. I'm creating a Windows
    forms-based application.
    You're in the wrong newsgroup - this newsgroup is for ASP.NET issues.

    Try: public.dotnet.l anguages.vc


    --
    Mark Rae
    ASP.NET MVP


    Comment

    • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

      #3
      Re: Event handling in VC++ 2005 .NET

      winnt events are really event flags (a single variable). to be notified of
      when an event value changes, use WaitForSingleOb jectEx or
      WaitForMutilple ObjectsEx (if you have more than 1 event).


      -- bruce (sqlwork.com)


      "Mark Rae [MVP]" wrote:
      "Ben" <bcwyatt65@hotm ail.comwrote in message
      news:780657ae-2995-4d33-be3f-f19c5e12efe9@26 g2000hsk.google groups.com...
      >
      I'm trying to setup a project that uses events. I'm creating a Windows
      forms-based application.
      >
      You're in the wrong newsgroup - this newsgroup is for ASP.NET issues.
      >
      Try: public.dotnet.l anguages.vc
      >
      >
      --
      Mark Rae
      ASP.NET MVP

      >
      >

      Comment

      • Mark Rae [MVP]

        #4
        Re: Event handling in VC++ 2005 .NET

        "bruce barker" <brucebarker@di scussions.micro soft.comwrote in message
        news:78FB09A8-4492-43CB-BB87-198193F78C82@mi crosoft.com...
        winnt events are really event flags (a single variable). to be notified of
        when an event value changes, use WaitForSingleOb jectEx or
        WaitForMutilple ObjectsEx (if you have more than 1 event).
        Yes I know...


        --
        Mark Rae
        ASP.NET MVP


        Comment

        Working...