I have an MFC application. In the application, I create 2 activeX controls (using CWnd's CreateControl() function),(control A and control B). I made the controls so I can add whatever I need to them. I guess it's important to note that both controls are created AND visible. Control A has a custom property of type 'unsigned long'. I use control A's property to pass it the HWND of control B. The application actually does the work. It passes control A the HWND of control B through control A's IDispatch interface. In control A, I cast the unsigned long to an HWND variable. I then attach the HWND to a CWnd object. I then have 'full' control over control B from control A. I can then do whatever I want to control B from control A. That is, I can perform standard CWnd methods on control B. This is the code I have used in control A:
ASSERT(m_hControlB != NULL);
CWnd * controlBCwnd = new CWnd;
controlBCwnd->Attach(m_hControlB);
//Do standard CWnd stuff here to control B.
controlBCwnd->Detach();
delete controlBCwnd;
What I really need to do is to set control B's properties from control A. This doesn't seem to be working since controlBCwnd isn't a pointer to an OLE control-type CWnd object?? It's just a standard CWnd. When I try to get a pointer to control B's IUnknown interface from control A, the program crashes. Being able to move control B around from control A is pretty cool, but that's not what I need to do. I need to set control B's properties from control A but it doesn't seem to work.
I hope this question is clear enough. It's hard to word the question so that it isn't too long to read.
Thanks in advance for any ideas.
ASSERT(m_hControlB != NULL);
CWnd * controlBCwnd = new CWnd;
controlBCwnd->Attach(m_hControlB);
//Do standard CWnd stuff here to control B.
controlBCwnd->Detach();
delete controlBCwnd;
What I really need to do is to set control B's properties from control A. This doesn't seem to be working since controlBCwnd isn't a pointer to an OLE control-type CWnd object?? It's just a standard CWnd. When I try to get a pointer to control B's IUnknown interface from control A, the program crashes. Being able to move control B around from control A is pretty cool, but that's not what I need to do. I need to set control B's properties from control A but it doesn't seem to work.
I hope this question is clear enough. It's hard to word the question so that it isn't too long to read.
Thanks in advance for any ideas.