Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to invoke a Form from a DLL

dubidubi Member Posts: 121
Hi friends,
I have a export function in the DLL.
When this function is to be called from other application,
it has to show the form in which the DLL was built with.
Can anyone help out?

For example

//GraphDlg.h
#include "NiGraph.h"
class CGraphDlg : public CDialog
{

public:
CGraphDlg(CWnd* pParent = NULL);
enum { IDD = IDD_GRAPH_DLG };
CNiGraph m_graph;//This is a ActiveX Control

public:
virtual void OnFinalRelease();
protected:
virtual void DoDataExchange(CDataExchange* pDX);

protected:
HICON m_hIcon;
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg void OnPlot1();
afx_msg void OnPlot2();

DECLARE_MESSAGE_MAP()
};

//DLLMain.cpp
#include "GraphDlg.h"

extern "C" __declspec(dllexport) void PlotWaveForm(double* Data,int
nSamples)
{
CNiReal64Vector StoreData(100);

for(int i=0;i<nSamples;i++)
StoreData[i]=Data[i];

CGraphDlg dlg;
dlg.m_graph.PlotY(StoreData);/* Here occurs Error*/
dlg.DoModal();
}
The error occurs because dlg.m_graph is NULL.
Even without the dlg.m_graph.PlotY(StoreData) statement,
the dlg.DoModal() is not working.

Help me how to create a instance of the ActiveX control and use it
and show the dialog form.

Thanks.
Sign In or Register to comment.