Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Windows
 ActiveX Controls
 PrintGraph() method crashes
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jfgibson

10 Posts

Posted - 19 Aug 2004 :  23:49:14  Show Profile  Reply with Quote
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

1534 Posts

Posted - 20 Aug 2004 :  08:51:28  Show Profile  Reply with Quote
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 ?
Go to Top of Page

jfgibson

10 Posts

Posted - 20 Aug 2004 :  21:23:53  Show Profile  Reply with Quote
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07