Accessing parent dialog?
-
Hello, I have a single dialog with a custom control which is based on the CWnd class. From method in the custom control, I need to access a variable from the dialog's class. How would I need to make this call to say a getValue() method? FYI, I am using VC6.
-
Hello, I have a single dialog with a custom control which is based on the CWnd class. From method in the custom control, I need to access a variable from the dialog's class. How would I need to make this call to say a getValue() method? FYI, I am using VC6.
ctroyp wrote:
Accessing parent dialog
Use GetParent(). This will provide you with a pointer with which you can call getValue().
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Hello, I have a single dialog with a custom control which is based on the CWnd class. From method in the custom control, I need to access a variable from the dialog's class. How would I need to make this call to say a getValue() method? FYI, I am using VC6.
Im not sure, whether the GetParent call from a COM control will work out. Anyway, call GetParent(), if you get a valid parent handler, type cast it to your Dialog class' pointer. using dynamic_cast will be safe for this. then you can call the public interfaces. You may have to use the header file and other stuffs of dialog class in the control class.
SaRath.
_"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
-
Hello, I have a single dialog with a custom control which is based on the CWnd class. From method in the custom control, I need to access a variable from the dialog's class. How would I need to make this call to say a getValue() method? FYI, I am using VC6.
you should not directly access the members of the dialog using the pointer, in which case your custom control no more is a reuseable custom control. You should define user defined message handlers in target window and then try to set/get anything using it. Vipin http://www.explorewindows.com/Blogs