Re: Pointer operations

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Scott McPhillips [MVP] (scottmcp_at_mvps.org.nothere)
Date: 06/07/04


Date: Mon, 07 Jun 2004 07:58:16 -0500

Macca wrote:
> Hi,
>
> I have created a pointer in a class A (Dialog class) on heap using new. This pointer is of type Class B and does various data processing. Now there is a variable in Class B that i want to be able to manipulate from another dialog Class C.
>
> This variable will be accessed in Class A and Class C.
>
> The way i was going to do this was to pass the pointer created in Class A ( using Lparam of SendMessage Call )to Class C. Class C would be able to change the state of this variable.
>
> My worry is that this method could cause problems. e.g class A and C accessing variable at the same time.
>
> Is the way im proposing valid?
>
> I'd appreciate opinions,
>
> Thanks
> Macca

Class A and C can not access a variable at the same time unless they are
executing in different threads. If you have not created multiple
threads then there is no problem.

-- 
Scott McPhillips [VC++ MVP]