maheshbeniwal
July 2nd, 1999, 07:55 AM
Dear All,
I have developed two activeX controls, say AX and BX. BX has one method called SetFileName which views file on mainframe window if we pass mainframe window as a parent window during Create method call of BX. It wroks fine. For both ocx i am using wrapper class and create method to create controls. Now my problem is i want to use BX->SetFileName method via AX. I am creating my AX in Application usin create method and passing mainframe window. Then there is method of AX called GetRx(long lWnd). I am passing mainframe window's handle and converting to other end. I did DEBUG .. i am getting same window on both the ends but it does not display any thing.
any ideas ?
here is my code
-----------------------------------------------------
This is applications's view class
-------------------------------------------------------------------
void CKControllerView::OnMcb()
{
CRect rInsoWnd;
GetClientRect(&rInsoWnd);
long longParam = (long)AfxGetApp()->m_pMainWnd->m_hWnd ;
AllocMemFormcb(CMcbViewer);
/* mcb is instance of wrapper class of AX */
mcb->Create("mcbViewer",WS_CHILD|WS_VISIBLE, rInsoWnd, (CWnd*)this, 1113,
NULL, FALSE);
/* Method of AX , given below */
mcb->GetRx(longParam);
}
----------------------------------------------------------------
AX activeX control which calls SetFileName of BX which views the file
----------------------------------------------------------------------------
-----------------------
long CMcbViewerCtrl::GetRx(long lhWnd)
{
CRect rInsoWnd;
GetClientRect(&rInsoWnd);
CWnd* wnd = CWnd::FromHandle(HWND(lhWnd));
AllocMemForViewer(CRxhighx);
/* Creating BX */
m_pViewerWnd->Create("Rxhighx", WS_CHILD|WS_VISIBLE, rInsoWnd, wnd, 2222,
NULL, FALSE);
/* this method works fine becuase later i am calling GetAction and returning
correct value */
m_pViewerWnd->SetAction(1);
/* This method works fine too b/c i am getting correct value in str but it
does not display */
m_pViewerWnd->SetFileName("C:\\winnt\\winnt.bmp");
return 0;
}
----------------------------------------------------------------------------
-----------------
> Dear COMXperts
>
> here is my problem. I created two activeX called AX and BX. And my
> application is APP. The job of BX is to display any file and exposes
> a
> method called Display. Both BX and AX are ocx controls.
>
> From my application I am calling one method of AX called
> Create&DisplayBX ,
> which creates BX and calls Display method of BX.
>
> I am using Create method of ocx to create my control on runtime (
> both AX
> and BX). That means i don't have any dialog or window in AX and BX
> to put
> control at design time. Since when we call Create method of any ocx
> we have
> to pass parent window. So my problem is how to pass my APP's view
> window to
> BX's parent window in AX's Create&Display method.
>
>
> I am passing AfxGetApp()->m_pMainWnd as long to Create&Display(long)
> method
> and casting long to CWnd* again in Create&Display Method of AX and
> passing
> that as a parentWnd. Will this work ? ? If yes then what's wrong ??
>
> Any other way to solve this problem ??? I would appreciate your
> guidance
>
> regards
> mahesh
I have developed two activeX controls, say AX and BX. BX has one method called SetFileName which views file on mainframe window if we pass mainframe window as a parent window during Create method call of BX. It wroks fine. For both ocx i am using wrapper class and create method to create controls. Now my problem is i want to use BX->SetFileName method via AX. I am creating my AX in Application usin create method and passing mainframe window. Then there is method of AX called GetRx(long lWnd). I am passing mainframe window's handle and converting to other end. I did DEBUG .. i am getting same window on both the ends but it does not display any thing.
any ideas ?
here is my code
-----------------------------------------------------
This is applications's view class
-------------------------------------------------------------------
void CKControllerView::OnMcb()
{
CRect rInsoWnd;
GetClientRect(&rInsoWnd);
long longParam = (long)AfxGetApp()->m_pMainWnd->m_hWnd ;
AllocMemFormcb(CMcbViewer);
/* mcb is instance of wrapper class of AX */
mcb->Create("mcbViewer",WS_CHILD|WS_VISIBLE, rInsoWnd, (CWnd*)this, 1113,
NULL, FALSE);
/* Method of AX , given below */
mcb->GetRx(longParam);
}
----------------------------------------------------------------
AX activeX control which calls SetFileName of BX which views the file
----------------------------------------------------------------------------
-----------------------
long CMcbViewerCtrl::GetRx(long lhWnd)
{
CRect rInsoWnd;
GetClientRect(&rInsoWnd);
CWnd* wnd = CWnd::FromHandle(HWND(lhWnd));
AllocMemForViewer(CRxhighx);
/* Creating BX */
m_pViewerWnd->Create("Rxhighx", WS_CHILD|WS_VISIBLE, rInsoWnd, wnd, 2222,
NULL, FALSE);
/* this method works fine becuase later i am calling GetAction and returning
correct value */
m_pViewerWnd->SetAction(1);
/* This method works fine too b/c i am getting correct value in str but it
does not display */
m_pViewerWnd->SetFileName("C:\\winnt\\winnt.bmp");
return 0;
}
----------------------------------------------------------------------------
-----------------
> Dear COMXperts
>
> here is my problem. I created two activeX called AX and BX. And my
> application is APP. The job of BX is to display any file and exposes
> a
> method called Display. Both BX and AX are ocx controls.
>
> From my application I am calling one method of AX called
> Create&DisplayBX ,
> which creates BX and calls Display method of BX.
>
> I am using Create method of ocx to create my control on runtime (
> both AX
> and BX). That means i don't have any dialog or window in AX and BX
> to put
> control at design time. Since when we call Create method of any ocx
> we have
> to pass parent window. So my problem is how to pass my APP's view
> window to
> BX's parent window in AX's Create&Display method.
>
>
> I am passing AfxGetApp()->m_pMainWnd as long to Create&Display(long)
> method
> and casting long to CWnd* again in Create&Display Method of AX and
> passing
> that as a parentWnd. Will this work ? ? If yes then what's wrong ??
>
> Any other way to solve this problem ??? I would appreciate your
> guidance
>
> regards
> mahesh