VS2010中MFC模板项目的困难

发布于 2024-09-08 20:21:09 字数 6845 浏览 7 评论 0原文

我正在使用 Visual Studio 2010 来试验 MFC。

我按照向导创建了一个模板 MFC 项目。我选择了基于对话框的应用程序,并取消选中 ActiveX 控件等其他选项。

未更改任何代码后,我按 F5,应用程序运行。

然后,使用表单设计器,将丰富的编辑控件从工具箱拖到应用程序上。我再次按 F5,应用程序编译但立即退出并显示错误代码 0。

为什么会发生这种情况?我做错了什么?

这是包含 RichEdit 时的输出:

'odpmfc2.exe': Loaded 'C:\Visual Studio 2010\Projects\odpmfc2\Debug\odpmfc2.exe', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100ud.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\lpk.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\usp10.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16385_none_ebf82fc36c758ad5\comctl32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msimg32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\apphelp.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sspicli.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\userenv.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\profapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\winspool.drv', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mpr.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100enu.dll', Binary was not built with debug information.
The program '[7420] odpmfc2.exe: Native' has exited with code 0 (0x0).

所有这些加载错误都发生有点可疑。但如果出现问题,为什么会以错误代码 0 退出呢?

这是成功运行的输出。加载失败仍然发生:

'odpmfc2.exe': Loaded 'C:\Visual Studio 2010\Projects\odpmfc2\Debug\odpmfc2.exe', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100ud.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\lpk.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\usp10.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16385_none_ebf82fc36c758ad5\comctl32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msimg32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\apphelp.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sspicli.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\userenv.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\profapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\winspool.drv', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mpr.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100enu.dll', Binary was not built with debug information.
'odpmfc2.exe': Loaded 'C:\Windows\System32\cryptbase.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\clbcatq.dll', Cannot find or open the PDB file
The program '[7956] odpmfc2.exe: Native' has exited with code 0 (0x0).

更新我删除了RichEdit,并添加了这些其他控件,并且工作正常:

  • MFC VSListBox控件
  • 列表控件
  • MFC链接控件
  • 网络地址控件

切线:为什么 RichEdit2 是表单生成器中唯一可用的 RichEdit? (我在 Windows 7 上使用 VS 2010)

I'm using Visual Studio 2010 to experiment with MFC.

I have created a template MFC project by following the wizard. I chose a dialog based app, and unchecked other options like ActiveX controls.

After making no code changes, I hit F5, and the app runs.

Then, using the form designer, I drag a rich edit control from the toolbox onto the app. I hit F5 again, and the app compiles but exits with error code 0 instantly.

Why could this be happening? What am I doing wrong?

This is the output when the RichEdit is included:

'odpmfc2.exe': Loaded 'C:\Visual Studio 2010\Projects\odpmfc2\Debug\odpmfc2.exe', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100ud.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\lpk.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\usp10.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16385_none_ebf82fc36c758ad5\comctl32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msimg32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\apphelp.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sspicli.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\userenv.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\profapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\winspool.drv', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mpr.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100enu.dll', Binary was not built with debug information.
The program '[7420] odpmfc2.exe: Native' has exited with code 0 (0x0).

It is a bit suspicious that all these load errors are occurring. But if something is going wrong, why is it exiting with error code 0?

Here is the output from a successful run. The load failures still occur:

'odpmfc2.exe': Loaded 'C:\Visual Studio 2010\Projects\odpmfc2\Debug\odpmfc2.exe', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100ud.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\lpk.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\usp10.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16385_none_ebf82fc36c758ad5\comctl32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msimg32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\apphelp.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sspicli.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\userenv.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\profapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\winspool.drv', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mpr.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100enu.dll', Binary was not built with debug information.
'odpmfc2.exe': Loaded 'C:\Windows\System32\cryptbase.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\clbcatq.dll', Cannot find or open the PDB file
The program '[7956] odpmfc2.exe: Native' has exited with code 0 (0x0).

UPDATE I removed the RichEdit, and added these other controls, and it works fine:

  • MFC VSListBox Control
  • List Control
  • MFC Link Control
  • Network Address Control

Tangent: Why is RichEdit2 the only RichEdit available in the form builder? (I'm using VS 2010 on Windows 7)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我爱人 2024-09-15 20:21:09

解决方案:我需要添加此调用:

LoadLibrary(TEXT("riched20.dll"));

MSDN

在 Microsoft Visual Studio 2005 和
后期可以添加丰富的
将控件编辑到对话框模板中
从工具箱中拖动控件。
但是,在对话框中执行此操作
编辑不保证
所需的库将在之前加载
控件已创建。这是
需要调用LoadLibrary
加载 Riched32.dll 的函数,
Riched20.dll 或之前的 Msftedit.dll
对话框已创建。

Solution: I needed to add this call:

LoadLibrary(TEXT("riched20.dll"));

As noted on MSDN:

In Microsoft Visual Studio 2005 and
later, it is possible to add a rich
edit control into a dialog template by
dragging the control from the toolbox.
However, doing this in the dialog
editor does not ensure that the
required library will be loaded before
the control is created. It is
necessary to call the LoadLibrary
function to load Riched32.dll,
Riched20.dll, or Msftedit.dll before
the dialog is created.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文