【发布时间】:2023-04-05 22:38:01
【问题描述】:
MSDN 包含一个创建桌面警报窗口的示例: http://msdn.microsoft.com/en-us/library/bb983515.aspx
示例代码以以下声明开头。
CMFCDesktopAlertWnd* pPopup = new CMFCDesktopAlertWnd;
当我在我的代码中使用它时,编译器会报错
'CMFCDesktopAlertWnd' : no appropriate default constructor available
这是我的应用程序的完整源代码。 (我在 Visual Studio 中创建了一个空的 Win32 项目并设置 Property | 上的 Use MFC in a Shared DLL 选项一般页面。)
#include <afxwin.h>
#include <afxDesktopAlertDialog.h>
class Notifier : public CWinApp
{
public:
virtual BOOL InitInstance();
};
BOOL Notifier::InitInstance()
{
CMFCDesktopAlertWnd* pPopup = new CMFCDesktopAlertWnd;
return TRUE;
}
Notifier myApp;
我做错了什么? 在 VS Express 2008 和 VS 2010 完整版中效果是一样的。
【问题讨论】:
标签: c++ visual-studio mfc desktop-application