Error 1406 Cannot Create A Top-level Child Window
Specific Boards Windows Programming Taskbars; 'Cannot create top level child window' Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get a compiler | Fixes for common problems Thread: Taskbars; 'Cannot create top level child window' Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 05-16-2007 #1 Gerread View Profile View Forum Posts Registered User Join Date Jun 2006 Posts 36 Taskbars; 'Cannot create top level child window' My current problem involves taskbars. I've added libcomctl32.a to the linker stuff in my project options in Dev C++ and included commctrl.h and it compiles OK. I have the code in my WM_CREATE for the main window. HWND hStatus is outside of it. Code: InitCommonControls(); hStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 40, 0, 40, g_hWnd, (HMENU)ID_STATUS, GetModuleHandle(NULL), NULL); int statwidths[] = {100, -1}; SendMessage(hStatus, SB_SETPARTS, 2, (LPARAM)statwidths); SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)"Hi there :)"); This is from the winprog status bar tutorial. Problem is, CreateWindowEx returns NULL and the error code is 1406 which apparently is 'Cannot create top level child window'. what? MSDN says something about it, but it is very brief and it's not from the developer perspective. A child window is 'any window that is not a top level window', but I can't see what's going on in the above that makes it like that. I read other posts that said the code there works fine. Any ideas? 05-16-2007 #2 Queatrix View Profile View Forum Posts Registered User Join Date Apr 2005 Posts 1,342 Maybe you made a mistake similar to the one in your other post? The reason I say that, is because that code compiles and runs fine for me. 05-16-2007 #3 CornedBee View Profile View Forum Posts Visit Homepage Cat without Hat Join Date
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 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 Creative Game Design Music and Sound Visual Arts Business Breaking into the Industry Production and Management Interviews http://cboard.cprogramming.com/windows-programming/89925-taskbars;-cannot-create-top-level-child-window.html Business and Law Event Coverage Forums All Forums Technical Game Programming General Programming Graphics Programming 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 http://www.gamedev.net/topic/158325-1406---cannot-create-a-top-level-child-window/ Sound Visual Arts Gallery Business Breaking into the Industry Business & Law Production & Management Community GDNet Lounge Coding Horrors Article Writing 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 1406 - Cannot create a top-level child window Started by Will O, May 21 2003 03:57 PM 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 6 replies to this topic #1 Will O Members -Reputation: 122 Like Likes Like Posted 21 May 2003 - 03:57 PM Hi, I''m trying to create a dialog box, and using GetLastError() and FormatMessage() I am getting that error after calling CreateDialog... any
Forum Visual C++ & C++ Programming Visual C++ Programming error 1406 If this is your first visit, be sure to check out the FAQ by clicking the link http://forums.codeguru.com/showthread.php?365952-error-1406 above. You may have to register or Login before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. http://stackoverflow.com/questions/39423719/cwindowimpl-create-returns-error-code-1406 Results 1 to 4 of 4 Thread: error 1406 Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode November error 1406 23rd, 2005,12:02 PM #1 Mitsukai View Profile View Forum Posts Visit Homepage Elite Member Join Date Aug 2005 Location Netherlands, The Posts 2,184 error 1406 trieing to create a static control i get this following error; 1406. Code: if(!PScreen.Load()) { FMain.MsgBox(CJText("Main() -> PScreen -> Load = ") & GetLastError()); CJApp.Quit(); return; } class PScreen: public CJPictureBox { public: PScreen(void): CJPictureBox(&FMain) { Move(FMain.Client()); } } PScreen; class CJPictureBox : error 1406 cannot public CJWnd { public: CJPictureBox(CJWnd* cParent) { GetClassInfoEx(CJApp.hInstance, "STATIC", &p_Class); p_ExStyle = WS_EX_CLIENTEDGE; p_hPWnd = cParent->Handle(); p_Style = WS_VISIBLE | WS_CHILD; } ~CJPictureBox(void) { Unload(); } bool Load(void) { return(Create() != NULL); } void Unload(void) const { Destroy(); } } *CJPPictureBox; class CJWnd { public: CJWnd(void) { sprintf(p_ClassName, "%x", this); memset(&p_Class, 0, sizeof(p_Class)); p_Class.cbSize = sizeof(p_Class); p_Class.cbWndExtra = sizeof(CJWnd*); p_Class.hInstance = CJApp.hInstance; p_Class.lpfnWndProc = p_WndProc; p_Class.lpszClassName = p_ClassName; p_Param = this; } HWND Create(void) { return(p_hWnd = CreateWindowEx(p_ExStyle, p_Class.lpszClassName, p_Caption.Str(), p_Style, p_Size.left, p_Size.top, p_Size.right, p_Size.bottom, p_hPWnd, p_hMenu, CJApp.hInstance, p_Param)); } } *CJPWnd; Reply With Quote November 23rd, 2005,12:12 PM #2 Rigel View Profile View Forum Posts Member + Join Date Sep 2004 Posts 561 Re: error 1406 Could you be a little more specific about the error? I have no idea what you mean when you say you have an error 1406. What are the details surrounding this problem? Reply With Quote November 23rd, 2005,12:20 PM #3 Igor Vartanov View Profile View Forum Posts Visit Homepage Elite Member Power Poster Join Date Nov 2000 Location Voronezh, Russia Posts 6,519 Re: error 1406 Originally Posted by Mitsukai trieing to create a static control i get this following error; 1406. 1406 means "Cannot create a top-lev
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or 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 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up CWindowImpl - Create() returns error code 1406 up vote 1 down vote favorite I just tried to setup a small win32 project, and was just about to create a window. I created a dialog in the resource designer and set up this class for my window: #pragma once #include "stdafx.h" class TTTMainDialog : public CWindowImpl