Jump to content
Software FX Community

Thread and ChartFX Client Server 5.1 with Visual C++ 6.0


User (Legacy)
 Share

Recommended Posts

Hi everybody,

I would like to know if we can put a chartfx control in a thread because I

do so but I have a problem. The graph is plotting itself and then every

lines dissapears. Is there any issues with thread with ChartFX ? This is

what I've done to put chartFX in thread.

1. Put those lines in the .h file to create the thread

static UINT ThreadFunc(LPVOID pvParam);//thread function

CWinThread *pThread; //the thread

2. Create a structure in the .cpp file

struct ThreadDataTest

{

CTestSDIDoc *pDoc1; //pointer to the active document

HWND hWnd; //Pass CWnd objects by HWND

test *testPtr; //pointer to the dialog

};

3, Create the function ThreadFunc

UINT test::ThreadFunc(LPVOID pvParam)

{

ThreadDataTest *td = static_cast<ThreadDataTest *>(pvParam);

td->testPtr->m_pChartFX2->Gallery=CURVE;

... //code to plot a graph

delete td; //free allocated memory for the structure

return 0;

}

4. Call the thread

ThreadDataTest *td = new ThreadDataTest;

td->pDoc1 = CTestSDIDoc::GetDoc();

td->hWnd=GetSafeHwnd();

td->testPtr=this;//this is the current object

pThread = AfxBeginThread(ThreadFunc,(LPVOID)td) ;//start the thread

In addition to this, I have created 2 chart with those lines in .h and .cpp

files CWnd m_ChartFX,m_ChartFX2; IChartFXPtr m_pChartFX,m_pChartFX2;

// ***CFX***

// Do not use class wizard to generate these. It will cause the generation

of unecesary classes DDX_Control(pDX, IDC_CHART1, m_ChartFX); if

(!pDX->m_bSaveAndValidate) // Link Chart FX pointer to control window

m_pChartFX = m_ChartFX.GetControlUnknown(); DDX_Control(pDX, IDC_CHART2,

m_ChartFX2); if (!pDX->m_bSaveAndValidate) // Link Chart FX pointer to

control window m_pChartFX2 = m_ChartFX2.GetControlUnknown(); // ***CFX***

Thanks a lot,

Ren

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...