Cannot Find Window Class Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you registerclass might have Meta Discuss the workings and policies of this site
Registerclassex
About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or
Createwindow
posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of
Createwindowex
4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up CreateWindow Fails as Unable to Find Window Class - C++ up vote 2 down vote favorite 1 In my application the function CreateWindow is failing for some reason. GetLastError indicates error 1407, which, according to the MSDN documentation is "Cannot find window class." The following code shows how CreateWindow is being called and the respective variables names at time of call: m_hInstance = ::GetModuleHandle( NULL ); if ( m_hInstance == NULL ) { TRACE(_T("CNotifyWindow::CNotifyWindow : Failed to retrieve the module handle.\r\n\tError: %d\r\n\tFile: %s\r\n\tLine: %d\r\n"), ::GetLastError(), __WFILE__, __LINE__); THROW(::GetLastError()); } m_hWnd = ::CreateWindow( _pwcWindowClass, // L"USBEventNotificationWindowClass" _pwcWindowName, // L"USBEventNotificationWindow" WS_ICONIC, 0, 0, CW_USEDEFAULT, 0, NULL, 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.\r\n\tError: %d\r\n\tFile: %s\r\n\tLine: %d\r\n"), ::GetLastError(), __WFILE__, __LINE__); THROW(::GetLastError()); } ::ShowWindow( m_hWnd, SW_HIDE ); What am I doing wrong? c++ visual-studio-2008 createwindow share|improve this question edited Nov 29 '10 at 18:20 asked Nov 29 '10 at 18:08 Jim Fell 4,1391885154 add a comment| 1 Answer 1 active oldest votes up vote 5 down vote accepted You have to call RegisterClassEx before you can use the window
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re sorry. The content you requested has been removed. You’ll be auto redirected in 1 second. MSDN Library MSDN Library MSDN Library MSDN Library Design Tools Development Tools and Languages Mobile and Embedded Development .NET Development Office development Online Services Open http://stackoverflow.com/questions/4306630/createwindow-fails-as-unable-to-find-window-class-c Specifications patterns & practices Servers and Enterprise Development Speech Technologies Web Development Windows Desktop App Development TOC Collapse the table of content Expand the table of content This documentation is archived and is not being maintained. This documentation is archived and is not being maintained. Error Message: Cannot find window class. Explanation: An application https://msdn.microsoft.com/en-us/library/ms820745.aspx tried to use a window class that was not an application-specific class registered with the system or one of the predefined control classes (such as BUTTON, LISTBOX, SCROLLBAR, and so on). User Action: Contact the supplier of the running application. Show: Inherited Protected Print Export (0) Print Export (0) Share IN THIS ARTICLE Is this page helpful? Yes No Additional feedback? 1500 characters remaining Submit Skip this Thank you! We appreciate your feedback. Dev centers Windows Office Visual Studio Microsoft Azure More... Learning resources Microsoft Virtual Academy Channel 9 MSDN Magazine Community Forums Blogs Codeplex Support Self support Programs BizSpark (for startups) Microsoft Imagine (for students) United States (English) Newsletter Privacy & cookies Terms of use Trademarks © 2016 Microsoft © 2016 Microsoft
topic ForumsMembersHelp Files Developer Journals Gallery Calendar Downloads Resources Store Classifieds Tracker Links Home For Beginners Articles All Articles Post an Article Technical Game Programming http://www.gamedev.net/topic/513829-win32-error-1407-cannot-find-window-class/ General Programming Graphics Programming and Theory DirectX and XNA OpenGL and Vulkan Multiplayer and Network Programming Artificial Intelligence Math and Physics Mobile Development Middleware, Libraries, and Tools Virtual and Augmented Reality https://www.experts-exchange.com/questions/21686192/error-1407-Cannot-find-window-class.html Creative Game Design Music and Sound Visual Arts Business Breaking into the Industry Production and Management Interviews Business and Law Event Coverage Forums All Forums Technical Game Programming General Programming Graphics Programming cannot find and Theory DirectX and XNA OpenGL & Vulkan Multiplayer and Network Programming Artificial Intelligence Math and Physics Mobile & Console Development Build Systems & Source Control Middleware, Libraries, and Tools Virtual and Augmented Reality Creative Game Design Writing For Games Music and Sound Visual Arts Gallery Business Breaking into the Industry Business & Law Production & Management Community GDNet Lounge Coding Horrors Article Writing cannot find window Comments, Suggestions and Ideas Your Announcements Hobby Project Classifieds Indie Project Showcase Community Developer Journals GDNet+ Subscriptions Gallery Store Classifieds Jobs Freelancers Hobby Projects Marketplace Newsletter » Home » Forums » The Technical Side » General Programming Chat Watched Content New Content 0 [WIN32] Error 1407: Cannot find window class Started by beun, Nov 05 2008 12:58 AM Old topic! Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic. You cannot reply to this topic 2 replies to this topic #1 beun Members -Reputation: 160 Like 0Likes Like Posted 05 November 2008 - 12:58 AM Hi, I'm running into a problem when I'm creating a window and I don't know why the following code is wrong: class WindowManager { private: HWND _window; HDC _DC; HGLRC _GLRC; HINSTANCE _instance; unsigned int _width; unsigned int _height; bool _isWindowOK; ... }; Error::Code WindowManager::MakeWindow () { int pixelFormat; WNDCLASS wc; RECT windowRect; windowRect.left = 0; windowRect.right = _width; windowRect.top = 0; windowRect.bottom = _height; _instance = Ge
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > error 1407, Cannot find window class Want to Advertise Here? Solved error 1407, Cannot find window class Posted on 2006-01-05 MS Development-Other 1 Verified Solution 14 Comments 1,601 Views Last Modified: 2013-12-03 Ok folks, need some quick help on this one... I'm driving myself crazy ;) I've got a DLL that has a dialog resource in it that I'm trying to launch. I keep getting "cannot find window class" as an error. I know that I'm trying to load the dialog from the right module because I'm calling GetModuleHandle with the DLL's name. Frustrating thing is I've done this before and I can't for the life of me figure out why I'm getting this error. Any help, as always, is greatly appreciated. Ron SetLastError(0); DWORD err = GetLastError(); // returns 0... good HMODULE mod = GetModuleHandle(MODULE_NAME); err = GetLastError(); // still returns 0 DialogBox(mod, MAKEINTRESOURCE(IDD_DIALOG), NULL, DialogProc); err = GetLastError(); // returns 1407, Cannot find window class 0 Question by:RonGriswold Facebook Twitter LinkedIn Google LVL 23 Best Solution byRoshan Davis I asked this because I found one related query in CodeGuru... He also has problem with *ONLY* .Net http://www.codeguru.com/forum/archive/index.php/t-295741.html ~roshan Go to Solution 14 Comments LVL 23 Overall: Level 23 MS Development-Other 8 Message Expert Comment by:Roshan Davis2006-01-05 You have to set the dll library as the resource to the application... in MFC way it is HINSTANCE hRes = NULL; hRes= LoadLibrary("ResourceD.dll"); if(hRes) AfxSetResourceHandle(hRes); ~roshan 0 Message Author Comment by:RonGriswold2006-01-05 Thanks roshmon, Actually, the dialog is being loaded from the dll. I've exported a func fro