Jump to content
Software FX Community

ztang

Members
  • Posts

    3
  • Joined

  • Last visited

ztang's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Dear support: We purchased the chartfx client server 5.1. In this version we can write the following code to create a chart object without ever chreating a window to display it. 1. in StdAfx.h file add the following code // DEFINITION of COM wrappers#import "C:\\Program Files\\Common Files\\Software FX Shared\\sfxbar.dll" no_namespace no_implementation#import "C:\\Program Files\\Common Files\\Software FX Shared\\Cfx4032.dll" no_namespace no_implementation 2. When we create a chartfx object I wrote the following code if(m_pChartFX== NULL){ bool bRetry = true; Retry: if (SUCCEEDED(CoGetClassObject(__uuidof(ChartFX),CLSCTX_INPROC_SERVER,NULL,IID_IClassFactory2,(LPVOID FAR *) &pFactory2))) { if (FAILED(pFactory2->CreateInstanceLic(NULL,NULL,__uuidof(IChartFX), g_sLicenseString, (LPVOID FAR *) &m_pChartFX))) return FALSE ; pFactory2->Release(); } else{ if(RegisterChartFXdlls()){ // just retry once if(false == bRetry)return FALSE; bRetry = false; goto Retry; } } } m_pChartFX is the type of IChartFXPtr in the old version. So by now, the m_pChartFX is initialized and I can call the functions that m_pChartFX provides. So far so good until we purchased the new version of CharFX client Server 6.2. We wanna upgrade our application to use the new API. The first question is I wanna do the similar way as the codes shown above. After I installed the version 6.2 I found the old chx4032.dll and sfxbar.dll is replaced by ChartFX.ClientServer.Core. dll (is it right?) So I change the code in StdAfx.h as shown below: 1. #import "C:\Program Files\Common Files\Software FX Shared\ChartFX.ClientServer.Core.dll" rename_namespace("Cfx62") rename("min","minX") rename("max","maxX") exclude("_CollectionBase","_Component","CollectionBase","Component") 2. I changed the old code to obtain a chartFX com object as show below Retry:// if (SUCCEEDED(CoGetClassObject(__uuidof(ChartFX),CLSCTX_INPROC_SERVER,NULL,IID_IClassFactory2,(LPVOID FAR *) &pFactory2))) { //upgrade if (SUCCEEDED(CoGetClassObject(__uuidof(Cfx62::Chart),CLSCTX_INPROC_SERVER,NULL,IID_IClassFactory2,(LPVOID FAR *) &pFactory2))) { // if (FAILED(pFactory2->CreateInstanceLic(NULL,NULL,__uuidof(IChartFX),same lisence string as the old purchase,(LPVOID FAR *) &m_pChartFX)))//upgrade XXX if (FAILED(pFactory2->CreateInstanceLic(NULL,NULL,__uuidof(Cfx62::_Chart),same lisence string as the old purchase,(LPVOID FAR *) &m_pChartFX))) return FALSE ; pFactory2->Release(); } else{ if(RegisterChartFXdlls()){ // just retry once if(false == bRetry)return FALSE; bRetry = false; goto Retry; } } } m_pChartFX now is the type of Cfx62::_ChartPtr Question is the license string still use the old purchase license string or I should get a new one? How and where can I get the new license string? Does the code shown above can succesfully create a COM object that I could use? I tried the code above that I can really initialize the m_pChartFX no matter I provide or not provide a license string. Of course the m_pChartFX doesn't work the way that I expect. For example, if I try to export a bitmap file by using m_pChartFX->Export(Cfx62::Fileformat_Bitmap,L"C:\\test.bmp"). it simply doesn't work. The test.bmp file has zero size Nothing is written in it. But When I export something else like binary format file or xml file, I can get something out. File is not empty. I know I can get Cfx62::_ChartPtr type object by creating a window the code might look like this //Create Window Control m_chartWnd.CreateControl(__uuidof(Cfx62::Chart), NULL, WS_VISIBLE, rc, this, IDC_CHART1, NULL, NULL, NULL /* License String goes here */); // Attach Window Control to Chart Pointer m_chartPtr = m_chartWnd.GetControlUnknown(); BSTR bstrLicense = ::SysAllocString(L"LicenseStringGoesHere"); m_chartPtr->SetLicenseString(bstrLicense) But I want to create m_charPtr by not creating a window at all like the code we wrote in the old version. How can we achieve this? Kindly Regards Tom
×
×
  • Create New...