Jump to content
Software FX Community

Problems in distributing to window2000 Server


User (Legacy)

Recommended Posts

Hi,

I'm using Chart Fx client server 5.1

with Visual C++ 6.0, on Windows XP.

Few days ago I ask for "license and distribution" problem.

Thank to fast reply, I can solve the problem.

My program show charming chart on other XP computer.

But, today I found the program does not show chart on computers whose O/S is

"Windows 2000 server",

Same situation as it's license is not registered.

detail information goes from here.....................

I use two dl files, and load chart dynamicaly

in my StdAfx.cpp file

#import "sfxbar.dll" no_namespace implementation_only

#import "Cfx4032.dll" no_namespace implementation_only

I want to run my program on computers where Chart Fx is not installled.

So I register dlls like this

regsvr32.exe Cfx4032.dll

regsvr32.exe SfxBar.dll

making chart routine is this.....................................

IClassFactory2 *pFactory2;

LPUNKNOWN pUnk;

HRESULT hr;

unsigned short s[] = L"___MY_LICENSE_STRING____";

hr =

CoGetClassObject(__uuidof(ChartFX),CLSCTX_INPROC_SERVER,NULL,IID_IClassFacto

ry2,(LPVOID FAR *) &pFactory2);

if (SUCCEEDED(hr)) {

hr = pFactory2->CreateInstanceLic(NULL,NULL,IID_IUnknown, s, (LPVOID FAR

*) &pUnk);

if (SUCCEEDED(hr)) {

m_pChartFX = pUnk;

pUnk->Release();

}

pFactory2->Release();

}

m_pChartFX.CreateInstance(__uuidof(ChartFX));

if (m_pChartFX!= NULL) {

m_pChartFX->CreateWnd((long)hwndParent, nID, x, y, cx, cy, dwStyle );

m_hwndChartFX = (HWND) m_pChartFX->hWnd;

m_chartFlag = TRUE;

setDefault();

}

return m_chartFlag;

Awaiting the pleasure of your reply.

Link to comment
Share on other sites

Thanks for fast reply.

Yes, "hr" return value is not valid.

I compare with old version, and I found the reason.

I move the "CoInitialize(NULL);" command to other position, but it was wrong

place.

In early version, "CoInitialize(NULL);" run every time chart is maked.

I want it to be initialize once, but it was wrong.

Now I put the code to "CMyProgramApp::CMyProgramApp() {}"

And It works!

I hope it is useful to the others.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...