I have a single program. Class A reads messages from a control box. I need to display this message on my dialog box(class B). Hence i create an instance of A in B. Now i need A to pass the message to B. Currently i have a fnction with a flag that i loop(in class B). Once a message is available in class A, class B reads the message and resets the flag. Is there a more efficient way to do this.