对话框程序打印时,出现的问题

对话框程序打印时,出现的问题

在对话框打印程序编程中,如果没有添加从CPreviewView()类中继承的类,没有自定义打印预览的工具栏时,在打印或打印预览时就会出现类似以下的错误:

Debug Assertion Failed!

Program:

  c:\users\[User_name]\[path_name]\[program_name.exe]

File: ViewPrnt.cpp

Line:127

for information on hwo you program can cause an assertion failure,

see the visual c++ documentation on asserts.

(Press Retry to debug the application)


如果出现以上信息,说明打印预览的工具栏没有加载,这种情况往往出现在使用静态链接库的情况(Use MFC in a static library),在使用动态链接库是不会出现问题的;但如果非要使用静态链接库,那就在程序中的*.rc文件中最底端添加一句"#include "l.chs\afxprint.rc" 可以解决上述问题。