CreateWindow因无法找到窗口类而失败 – C
发布时间:2020-12-16 09:31:02 所属栏目:百科 来源:网络整理
导读:在我的应用程序中,CreateWindow函数由于某种原因失败. GetLastError指示错误1407,根据MSDN文档,“无法找到窗口类”.以下代码显示了如何调用CreateWindow以及调用时的相应变量名称: m_hInstance = ::GetModuleHandle( NULL );if ( m_hInstance == NULL ){ TR
在我的应用程序中,CreateWindow函数由于某种原因失败. GetLastError指示错误1407,根据MSDN文档,“无法找到窗口类”.以下代码显示了如何调用CreateWindow以及调用时的相应变量名称:
m_hInstance = ::GetModuleHandle( NULL ); if ( m_hInstance == NULL ) { TRACE(_T("CNotifyWindow::CNotifyWindow : Failed to retrieve the module handle.rntError: %drntFile: %srntLine: %drn"),::GetLastError(),__WFILE__,__LINE__); THROW(::GetLastError()); } m_hWnd = ::CreateWindow( _pwcWindowClass,// L"USBEventNotificationWindowClass" _pwcWindowName,// L"USBEventNotificationWindow" WS_ICONIC,CW_USEDEFAULT,NULL,m_hInstance,// 0x00400000 NULL ); if ( m_hWnd == NULL ) // m_hWnd is returned as NULL and exception is thrown. { TRACE(_T("CNotifyWindow::CNotifyWindow : Failed to create window.rntError: %drntFile: %srntLine: %drn"),__LINE__); THROW(::GetLastError()); } ::ShowWindow( m_hWnd,SW_HIDE ); 我究竟做错了什么? 解决方法
您必须先调用
RegisterClassEx才能在CreateWindow上使用窗口类.
示例代码here.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 在C中移动对象后,如何更新QuadTree?
- Cocos2d-x3.3利用TileMap绘制Polygon/PolyLine
- 两种接口传送数据协议(xml和json)
- 正则表达式 – 使用grep匹配md5哈希
- ruby – Puppet:嵌套的hash / dict,数组:如何在erb中访问
- xml中用fragment出现Error inflating class fragment的问题
- jQuery+json实现的简易Ajax调用实例
- Ajax 请求的http头信息特点 x-requested-with
- ruby-on-rails – Rails – 在通过活动资源使用API??时,URL
- Flex DataGrid中的DataGridColumn实现Tooltip/Datatip(flex