Hi,
I try to create an oscillospe with xulrunner plugins.
So I have only an handle window.
I tried (with others libraries is OK) to create the component from this handle :
The idea :The plugin call a shared librairie wich export some fonctions to manage a graph. On init the plugin give the hwnd.
CNiGraphChild g_GraphComponent;
MFCDLLWRAPPER_API void OScope_InitWrapper(HANDLE i_hWindow)
{
CWnd* l_pWnd = CWnd::FromHandle((HWND)i_hWindow);
RECT l_Rect = {0};
l_pWnd->GetClientRect(&l_Rect);
CWnd* l_pWnd2 = new CWnd;
l_pWnd2->Create(_T("STATIC"), "Hi", WS_CHILD | WS_VISIBLE, l_Rect, l_pWnd, 1234);
g_GraphComponent->Create(WS_VISIBLE | WS_CHILD, l_Rect, l_pWnd2);
}
AND CNiGraphChild class
#include "NiGraph.h"
using namespace NI;
class CNiGraphChild : public CNiGraph
{
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNiGraphChild)
public:
virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID=NULL);
//}}AFX_VIRTUAL
//virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID=NULL);
void msgStrFnc(char* msgStr);
};
BOOL CNiGraphChild::Create(DWORD dwStyle, const RECT& rect,
CWnd* pParentWnd, UINT nID)
{
BOOL result ;
static CString className = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW) ;
result = CWnd::CreateEx(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE,
className, NULL, dwStyle,
rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
pParentWnd->GetSafeHwnd(), (HMENU)nID) ;
return result ;
} // Create
When I call CWnd::CreateEx xulrunner crash. (mfc42.dll afxwin1.inl line19)
I tried several solutions.
Thanks for your helps.
Manu