對話框程序打印時,出現的問題

在對話框打印程序編程中,如果沒有添加從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" 可以解決上述問題。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章