User (Legacy) Posted May 19, 2000 Report Share Posted May 19, 2000 Good morning Frank! I have a important problem for you. I have an application that opens up to 16 charts (which I create dynamically using VC6.0 and the dll). The problem is that the charts cause a massive resource hit (40+% for 25 charts, 30% for 16 charts, 16% for 8 charts) when I import them. This causes my User's computer to crash if they have almost anything else open. I tracked down the problem to the actually import statement from the chart fx object- Ie. if I import the chart from a file, its hits my resources hard, if I dont import it- no major resource hit (it tends to reduce the hit to 2-3%). This is even if I edit the chart to look like an imported chart- it doesnt hit the resources until I load it from a file. Any solutions to this problem would be very appreciated. Here is the main code for this problem: hfile = CreateFile(m_filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hfile != INVALID_HANDLE_VALUE) { GetWindowRect(rc); ScreenToClient(rc); long l = GetWindowLong(m_hWnd, GWL_WNDPROC); int ID = IDC_CHARTPLOT1 + 1; int i = 0; for (i = 0; i < MAX_PLOTS_PER_PAGE; i++) { // for each chart, create a m_pChartFX if (SUCCEEDED(hr = CoGetClassObject(__uuidof(ChartFX), CLSCTX_INPROC_SERVER, NULL, IID_IClassFactory2, (LPVOID FAR *) &pFactory2))) hr = pFactory2->CreateInstanceLic (NULL, NULL, IID_IUnknown, license, (LPVOID FAR *) &pUnk); if (SUCCEEDED(hr)) { m_pChartFX[i] = pUnk; pUnk->Release(); } else { MessageBox("Createinstancelicense failed"); } } m_pChartFX[i].Release(); m_pChartFX[i].CreateInstance(__uuidof(ChartFX)); m_pChartFX[i]->OpenDataEx((CfxCod) (COD_XVALUES), 1, COD_UNKNOWN); m_pChartFX[i]->OpenDataEx((CfxCod) (COD_VALUES), 1,COD_UNKNOWN); m_pChartFX[i]->ValueEx[0][0] = 0; m_pChartFX[i]->XValueEx[0][0] = 0; m_pChartFX[i]->CloseData((CfxCod) (COD_XVALUES | COD_SMOOTH)); m_pChartFX[i]->CloseData((CfxCod) (COD_VALUES | COD_SMOOTH)); m_pChartFX[i]->FileMask = (CfxFileMask) ( FMASK_COLORS | FMASK_ELEMENTS | FMASK_EXTENSIONS | FMASK_FONTS | FMASK_GENERAL | FMASK_LABELS | FMASK_MULTI | FMASK_PRINTERINFO | FMASK_SCALE | FMASK_TITLES); for (i = 0; i < MAX_PLOTS_PER_PAGE; i++) { // for each chart, create a m_pChartFX m_pChartFX[i]->CreateWnd((long)this->m_hWnd, (ID + i), rc.left, rc.top, rc.right, rc.left, WS_CHILD | WS_THICKFRAME); m_hwndChartFX[i] = (HWND)m_pChartFX[i]->hWnd; pFactory2->Release(); ::ShowWindow(m_hwndChartFX[i], SW_SHOW); // here is the problem code - each time this next line is called, i lose 2-3% of resources.... m_pChartFX[i]->Import(CHART_CFXFILE, (long)hfile); Sleep(0); } l = GetWindowLong(m_hWnd, GWL_WNDPROC); CloseHandle(hfile); } Thanks in advance... -- Josh Eanes Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.