ActiveX控件中的列印代碼一直是運作正常,可今天為了修改ActiveX控件的版本,修改資源檔案後,列印功能一直報錯。
Debug後發現錯誤描述資訊是:
ERROR: Cannot find dialog template with IDD 0x7803.
錯誤的根源就是下述代碼,原因是用于列印預覽的對話框工具欄的資源無法找到,而這些資源是在afxprint.rc檔案中的。
複制代碼
#ifdef _DEBUG
// dialog template must exist and be invisible with WS_CHILD set
if (!_AfxCheckDialogTemplate(lpszTemplateName, TRUE))
{
ASSERT(FALSE); // invalid dialog template name
PostNcDestroy(); // cleanup if Create fails too soon
return FALSE;
}
#endif //_DEBUG
是以修改的方法也很簡單,用“源代碼文本編輯器”打開資源檔案”XXX.rc”,在其中加入
#include "l.chs\\afxprint.rc"
本文轉自Phinecos(洞庭散人)部落格園部落格,原文連結:http://www.cnblogs.com/phinecos/archive/2009/03/04/1402669.html,如需轉載請自行聯系原作者