Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Multiple Events

Multiple Events

Scheduled Pinned Locked Moved C / C++ / MFC
c++questioncsharphelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    thenutz72
    wrote on last edited by
    #1

    Hello, I am writing a BlackJack type program to learn C++/.NET. I'm, trying to raise an event from Shoe Class (DealtCutCard Event) which is used by Dealer Class. Dealer sets a flag and at the apprpriate time raises a DealerShuffles Event which the Shoe Class uses. This code won't compile, the error is in the Shoe.h: "improper syntax for specifying event in __hook/__unhook" line 25 "improper syntax for specifying event in __hook/__unhook" line 25 "improper syntax for specifying event in __hook/__unhook" line 25 If I comment out #include "Dealer.h" and the __hook init function this will compile, but now I can only raise events from Shoe it won't recieve events from Dealer. How can I both call and handle events from between the same two classes? BTW - note i NEED "Shoe.h" in Dealer because there are functions in Dealer that reference Shoes. Using .NET 2003 Also, I tried substituting #include "Dealer.h" with class Dealer; as a predeclaration but that didn't work. Dealer.h

    #pragma once

    #include "Bettor.h"
    #include "Hand.h"
    #include "Shoe.h"

    #ifndef DEALER_H

    define DEALER_H

    [event_source(native)]
    [event_receiver(native)]

    class Dealer
    {
    public:
    __event void DealerShuffles(void);
    Dealer(Shoe*);
    void InitShoeEvents(Shoe* pSource){
    __hook(&Shoe::DealtCutCard, pSource, &Dealer::ReadyToDeal);};
    };
    #endif

    Shoe.h

    #pragma once

    #ifndef SHOE_H

    define SHOE_H

    #include "Dealer.h"

    [event_receiver(native)]
    [event_source(native)]
    class Shoe
    {
    public:
    void Shuffle(void);
    //Initialize events from Dealer
    void InitDealEvents(Dealer* pSource){
    __hook(&Dealer::DealerShuffles, pSource, &Shoe::Shuffle);};
    //Events
    __event void DealtCutCard(void);
    //Variables
    };
    #endif

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups