Author |
Topic  |
|
jfgibson
10 Posts |
Posted - 19 Aug 2004 : 23:49:14
|
I am using the CTWX.OCX charting ActiveX control with Visual C++ V6.0 on Windows XP Pro. Everything is working fine for building and displaying a chart. Then I call PrinterSetup(), followed by PrintGraph(), at which point an error occurs.
Stepping through the code, when the following call executes, Windows returns the error message "Unhandled exception in <myExecutable> (WCT32DX.DLL); 0xC0000005: Access Violation.
void CCTWX::PrintGraph() { InvokeHelper(0x4e, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); }
I get the same type of error if, instead of calling the print method, I call the SavePageMeta() method.
Is it clear to anyone what might be happening?
Further detail: Stepping into the InvokeHelper method, the violation occurs at the end of this chain of calls:
In WINOCC.CPP: m_pCtrlSite->InvokeHelperV(dwDispID, wFlags, vtRet, pvRet, pbParamInfo, argList);
In OCCSITE.CPP: m_dispDriver.InvokeHelperV(dwDispID, wFlags, vtRet, pvRet, pbParamInfo, argList);
In OLEDISP2.CPP: SCODE sc = m_lpDispatch->Invoke(dwDispID, IID_NULL, 0, wFlags, &dispparams, pvarResult, &excepInfo, &nArgErr);
Error occurs on the above call, with dispparams appearing to contain a lot of null variables.
Jim Gibson |
|
quinncurtis
1164 Posts |
Posted - 20 Aug 2004 : 08:51:28
|
Is this the first time you have tried to print. Did the functions work under a different operating system, or in a different program.
The print and metafile functions CANNOT be called in the graph building (OnInitialUpdate) routine with the graph property initialization methods. They can only be called after the graph is displayed on the screen, which takes place after the OnInitialUpdate method.
Can you modiy the example program Simple, adding a button to invoke printing, to demonstrate the problem ? |
 |
|
jfgibson
10 Posts |
Posted - 20 Aug 2004 : 21:23:53
|
That was indeed the problem... I was trying to print from the BuildGraph() method, which is called inside OnInitialUpdate(). I moved the print calls into a separate command handler, and it works fine. Thank you very much!
Jim Gibson |
 |
|
|
Topic  |
|
|
|