解决打印代码的一个Bug

xiaoxiao2022-11-22  212

ActiveX控件中的打印代码一直是运行正常,可今天为了修改ActiveX控件的版本,修改资源文件后,打印功能一直报错。

Debug后发现错误描述信息是:

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> ERROR:Cannot find dialogtemplatewithIDD 0x7803 .

错误的根源就是下述代码,原因是用于打印预览的对话框工具栏的资源无法找到,而这些资源是在afxprint.rc文件中的。

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> #ifdef_DEBUG // dialogtemplatemustexistandbeinvisiblewithWS_CHILDset if ( ! _AfxCheckDialogTemplate(lpszTemplateName,TRUE)) { ASSERT(FALSE); // invaliddialogtemplatename PostNcDestroy(); // cleanupifCreatefailstoosoon return FALSE; } #endif // _DEBUG

因此修改的方法也很简单,用源代码文本编辑器打开资源文件”XXX.rc”,在其中加入

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> #include " l.chs//afxprint.rc "

参考资料

http://www.codeguru.com/forum/showthread.php?t=347195

转载请注明原文地址: https://www.6miu.com/read-4979052.html

最新回复(0)