• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

MystikReasons

Members
  • Content count

    11
  • Joined

  • Last visited

Community Reputation

122 Neutral

About MystikReasons

  • Rank
    Member

Personal Information

  • Interests
    |programmer|
  1. Hello I get many errors from wxWidget classes and I don't know why. They don't make the program crash. Does somebody know, why wxWidget creates so many errors? Im using the newest stable version of wxWidget and I build the solution at my own. ..\..\src\msw\control.cpp(149): 'CreateWindowEx("ToolbarWindow32", flags=52008900, ex=00000000)' failed with error 0x0000057e (Subordinate window can not be created at the top level.). H:\WxWidgets\include\wx/msw/private.h(406): 'GetClientRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). ..\..\src\msw\window.cpp(1962): 'MoveWindow' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(406): 'GetClientRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). ..\..\src\msw\window.cpp(1962): 'MoveWindow' failed with error 0x00000578 (Invalid window handle). ..\..\src\msw\toolbar.cpp(1112): 'TB_ADDBUTTONS' failed with error 0x00000578 (Invalid window handle). ..\..\src\msw\toolbar.cpp(290): 'TB_GETITEMRECT' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). H:\WxWidgets\include\wx/msw/private.h(394): 'GetWindowRect' failed with error 0x00000578 (Invalid window handle). ..\..\src\msw\window.cpp(1962): 'MoveWindow' failed with error 0x00000578 (Invalid window handle)
  2. You are absolutly right, it works now but not how as I wanted but anyways thank you  :D  I'll try to fix the other problem tomorrow  :)
  3. Thank you for that useful information.   The debugger says, that the hWndComboBox_File NULL is. Yes I'm creating a wWindow instance, which I used to get the hWnd but the instance is also deleting itself, because its on the stack. hWndParent = wWindow.getHwnd(); // Get the window from the Window Class Could this be the error?
  4. I get an error from GetLastError, saved it in an txt. file What does this error mean to my problem? ERROR_ALREADY_EXISTS Cannot create a file when that file already exists. 183 (0xB7)  
  5. @Fredericvo   I move the instantiate now after I register and create the main window, but it still doesn't work. Heres the code for the core functions. HRESULT wWindow::Initialize() { HRESULT hr; // Create the window class. WNDCLASSEX wcex = { sizeof(WNDCLASSEX) }; wcex.style = CS_HREDRAW | CS_VREDRAW; // The class styles - CS_HREDRAW: Redraws the window if a movement changes the width of the client area. // CS_VREDRAW: Redraws the window if a movement changes the height of the client area. wcex.lpfnWndProc = wWindow::WndProc; // A pointer to the windows procedure. wcex.cbClsExtra = 0; // The number of extra bytes to allocate the window-class structure. wcex.cbWndExtra = sizeof(LONG_PTR); // The number of extra bytes to allocate following the window instance. wcex.hInstance = HINST_THISCOMPONENT; // A handle to the instance that contains the window procedure for the class. wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); // A handle to the class background brush. wcex.lpszMenuName = NULL; // Pointer to a null-terminated character string that specifies the resource name of the class menu. wcex.hCursor = LoadCursor(NULL, IDC_ARROW); // A handle to the class cursor, contains the cursor for the window. wcex.lpszClassName = TEXT("DemoApp"); // The name of the class // Register the window class. RegisterClassEx(&wcex); // Create the application window. // // Because the CreateWindow function takes its size in pixels, we // obtain the system DPI and use it to scale the window size. int dpiX = 0; int dpiY = 0; HDC hdc = GetDC(NULL); if (hdc) { dpiX = GetDeviceCaps(hdc, LOGPIXELSX); // Get the pixels from width dpiY = GetDeviceCaps(hdc, LOGPIXELSY); // Get the pixels from height ReleaseDC(NULL, hdc); } // Create the window m_hwnd = CreateWindow(TEXT("DemoApp"), // Class name. TEXT("CircuitSim"), // Window name. WS_OVERLAPPEDWINDOW |WS_HSCROLL | WS_VSCROLL, // Window style - WS_OVERLAPPEDWINDOW: The window is an overlapped window. CW_USEDEFAULT, // Use the default x position. CW_USEDEFAULT, // Use the default y position. static_cast<UINT>(ceil(640.f * dpiX / 96.f)), // Use the width, which we calculated with the pixels. static_cast<UINT>(ceil(480.f * dpiY / 96.f)), // Use the height, which we calculated with the pixels. NULL, // A handle to the parent window NULL, // A handle to a menu HINST_THISCOMPONENT, // A handle to the instance of the module this); // A pointer to a value to be passed to the window through the CREATESTRUCT structure ComboBox m_comboBox; // Create a instance for ComboBox // Initialize all the combo boxes here // Check if the window passed the following checks - S_OK: Operation sucessful // E_FAIL: Unspecified failure hr = m_hwnd ? S_OK : E_FAIL; if (SUCCEEDED(hr)) { ShowWindow(m_hwnd, SW_MAXIMIZE); // Show the window - SW_MAXIMIZE: set the window to fullscreen UpdateWindow(m_hwnd); } return hr; } LRESULT CALLBACK wWindow::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { LRESULT result = 0; if (message == WM_CREATE) { LPCREATESTRUCT pcs = (LPCREATESTRUCT)lParam; wWindow *pWindow = (wWindow *)pcs->lpCreateParams; ::SetWindowLongPtrW( hwnd, GWLP_USERDATA, PtrToUlong(pWindow) ); result = 1; } else { wWindow *pWindow = reinterpret_cast<wWindow *>(static_cast<LONG_PTR>( ::GetWindowLongPtrW( hwnd, GWLP_USERDATA))); bool wasHandled = false; if (pWindow) { switch (message) { case WM_COMMAND: { // If the user makes a selection from the list: // Send CB_GETCURSEL message to get the index of the selected list item. // Send CB_GETLBTEXT message to get the item. // Display the item in a messagebox. if (HIWORD(wParam) == CBN_SELCHANGE) { int ItemIndex = SendMessage((HWND)lParam, (UINT)CB_GETCURSEL, (WPARAM)0, (LPARAM)0); TCHAR ListItem[256]; (TCHAR)SendMessage((HWND)lParam, (UINT)CB_GETLBTEXT, (WPARAM)ItemIndex, (LPARAM)ListItem); // TODO: // Do something after that } wasHandled = true; result = 0; } break; // The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed. case WM_DISPLAYCHANGE: { InvalidateRect(hwnd, NULL, FALSE); } wasHandled = true; result = 0; break; // Destroy the window case WM_DESTROY: { PostQuitMessage(0); } wasHandled = true; result = 1; break; } } if (!wasHandled) { result = DefWindowProc(hwnd, message, wParam, lParam); } } return result; } void ComboBox::Initialize() { wWindow wWindow; // Create a instance of wWindow class //////////////////////////////////// // // // Combobox Informations // // // //////////////////////////////////// TCHAR Combobox_File[7][13] = { TEXT("New"), TEXT("Open"), TEXT("Add"), TEXT("Save Ctrl+S"), TEXT("Save As..."), TEXT("Save All"), TEXT("Exit Alt+F4") }; // Create the parameters for FILE Combobox // // Uses the CreateWindow function to create a child window of // the application window. The WC_COMBOBOX window style specifies // that it is a combobox. int xPos = 100; // Horizontal position of the window int yPos = 100; // Vertical position of the window int nWidth = 200; // Width of the window int nHeight = 200; // Height of the window hWndParent = wWindow.getHwnd(); // Get the window from the Window Class // Create the Combobox_File hWndComboBox_File = CreateWindow(WC_COMBOBOX, TEXT(""), CBS_DROPDOWN | CBS_HASSTRINGS | WS_CHILD | WS_VISIBLE, xPos, yPos, nWidth, nHeight, hWndParent, NULL, HINST_THISCOMPONENT, NULL); TCHAR A[17]; int k = 0; memset(&A, 0, sizeof(A)); // Go trough every TEXT in the string for (k = 0; k <= 8; k += 1) { // Copies a string _tcscpy_s(A, sizeof(A) / sizeof(TCHAR), (TCHAR*)Combobox_File[k]); // Add string to combobox SendMessage(hWndComboBox_File, (UINT)CB_ADDSTRING, (WPARAM)0, (LPARAM)A); } // Send the CB_SETCURSEL message to display an initial item // in the selection field SendMessage(hWndComboBox_File, CB_SETCURSEL, (WPARAM)2, (LPARAM)0); return; } int WINAPI WinMain( HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPSTR /* lpCmdLine */, int) /* nCmdShow */ { HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); if (SUCCEEDED(CoInitialize(NULL))) { { wWindow app; if (SUCCEEDED(app.Initialize())) { app.RunMessageLoop(); } } CoUninitialize(); } return 0; }
  6. @Amr0   How do I call the InitCommonControlsEx? I only find this https://msdn.microsoft.com/en-us/library/windows/desktop/bb775507(v=vs.85).aspx but I dont know how to use it  :rolleyes:   Can I make it this way? Because I get an error.   Severity Code Description Project File Line Suppression State Error LNK2019 Reference to non-resolved external symbol "__imp_InitCommonControlsEx" in function "WinMain". INITCOMMONCONTROLSEX InitCtrlEx; InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX); InitCtrlEx.dwICC = ICC_LINK_CLASS, ICC_PROGRESS_CLASS; InitCommonControlsEx(&InitCtrlEx); if (!InitCommonControlsEx(&InitCtrlEx)) { int nResult = GetLastError(); MessageBox(NULL, L"Could not initialize common controls class!", L"Initialization failure", MB_ICONERROR); } EDIT: I call it in the WinMain function
  7.   No the combo box doesn't show at all even if I call it in the Init function of the window.   Thats my WndProc. LRESULT CALLBACK wWindow::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { LRESULT result = 0; if (message == WM_CREATE) { LPCREATESTRUCT pcs = (LPCREATESTRUCT)lParam; wWindow *pWindow = (wWindow *)pcs->lpCreateParams; ::SetWindowLongPtrW( hwnd, GWLP_USERDATA, PtrToUlong(pWindow) ); result = 1; } else { wWindow *pWindow = reinterpret_cast<wWindow *>(static_cast<LONG_PTR>( ::GetWindowLongPtrW( hwnd, GWLP_USERDATA))); bool wasHandled = false; if (pWindow) { switch (message) { case WM_COMMAND: { // If the user makes a selection from the list: // Send CB_GETCURSEL message to get the index of the selected list item. // Send CB_GETLBTEXT message to get the item. // Display the item in a messagebox. if (HIWORD(wParam) == CBN_SELCHANGE) { int ItemIndex = SendMessage((HWND)lParam, (UINT)CB_GETCURSEL, (WPARAM)0, (LPARAM)0); TCHAR ListItem[256]; (TCHAR)SendMessage((HWND)lParam, (UINT)CB_GETLBTEXT, (WPARAM)ItemIndex, (LPARAM)ListItem); // TODO: // Do something after that } wasHandled = true; result = 0; } break; // The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed. case WM_DISPLAYCHANGE: { InvalidateRect(hwnd, NULL, FALSE); } wasHandled = true; result = 0; break; // Destroy the window case WM_DESTROY: { PostQuitMessage(0); } wasHandled = true; result = 1; break; } } if (!wasHandled) { result = DefWindowProc(hwnd, message, wParam, lParam); } } return result; } Yes I found Spy++, now I only have to find out how it works  :rolleyes:
  8. Hello Prototype   No im passing a handle for the parentwindow hWndParent = wWindow.getHwnd(); // Get the window from the Window Class // Create the Combobox_File hWndComboBox_File = CreateWindow(WC_COMBOBOX, TEXT(""), CBS_DROPDOWN | CBS_HASSTRINGS | WS_CHILD | WS_OVERLAPPED | WS_VISIBLE, xPos, yPos, nWidth, nHeight, hWndParent, // HERE NULL, HINST_THISCOMPONENT, NULL); I dont get an error, it starts the program correct and it also shows the main window with my settings for it. It seems like it doesn't get the message from the combo box but I dont know why.   EDIT: Also used the debugger to find the problem, but it works normally. The program copies the strings and then sends via the function SendMessage.
  9. Thank you for your reply, I've changed it.   ^_^
  10. Hello   I have a problem with my combo box that  I've created. I've already asked in another forum, but they didn't knew the error.   Thats where I create the Combo Box and I call this Init function in the constructor. void ComboBox::Initialize() { wWindow wWindow; //////////////////////////////////// // // // Combobox Informations // // // //////////////////////////////////// TCHAR Combobox_File[7][13] = { TEXT("New"), TEXT("Open"), TEXT("Add"), TEXT("Save Ctrl+S"), TEXT("Save As..."), TEXT("Save All"), TEXT("Exit Alt+F4") }; // Create the parameters for FILE Combobox // // Uses the CreateWindow function to create a child window of // the application window. The WC_COMBOBOX window style specifies // that it is a combobox. int xPos = 100; // Horizontal position of the window int yPos = 100; // Vertical position of the window int nWidth = 200; // Width of the window int nHeight = 200; // Height of the window hWndParent = wWindow.getHwnd(); // Get the window from the Window Class // Create the Combobox_File hWndComboBox_File = CreateWindow(WC_COMBOBOX, TEXT(""), CBS_DROPDOWN | CBS_HASSTRINGS | WS_CHILD | WS_OVERLAPPED | WS_VISIBLE, xPos, yPos, nWidth, nHeight, hWndParent, NULL, HINST_THISCOMPONENT, NULL); TCHAR A[16]; int k = 0; memset(&A, 0, sizeof(A)); // Go trough every TEXT in the string for (k = 0; k <= 8; k += 1) { // Copies a string wcscpy_s(A, sizeof(A) / sizeof(TCHAR), (TCHAR*)Combobox_File[k]); // Add string to combobox SendMessage(hWndComboBox_File, (UINT)CB_ADDSTRING, (WPARAM)0, (LPARAM)A); } // Send the CB_SETCURSEL message to display an initial item // in the selection field SendMessage(hWndComboBox_File, CB_SETCURSEL, (WPARAM)2, (LPARAM)0); return; } And here I create a instance of the Combo Box. HRESULT wWindow::Initialize() { HRESULT hr; ComboBox m_comboBox; // Create a instance for ComboBox // Initialize all the combo boxes here // Create the window class. WNDCLASSEX wcex = { sizeof(WNDCLASSEX) }; wcex.style = CS_HREDRAW | CS_VREDRAW; // The class styles - CS_HREDRAW: Redraws the window if a movement changes the width of the client area. // CS_VREDRAW: Redraws the window if a movement changes the height of the client area. wcex.lpfnWndProc = wWindow::WndProc; // A pointer to the windows procedure. wcex.cbClsExtra = 0; // The number of extra bytes to allocate the window-class structure. wcex.cbWndExtra = sizeof(LONG_PTR); // The number of extra bytes to allocate following the window instance. wcex.hInstance = HINST_THISCOMPONENT; // A handle to the instance that contains the window procedure for the class. wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); // A handle to the class background brush. wcex.lpszMenuName = NULL; // Pointer to a null-terminated character string that specifies the resource name of the class menu. wcex.hCursor = LoadCursor(NULL, IDC_ARROW); // A handle to the class cursor, contains the cursor for the window. wcex.lpszClassName = TEXT("DemoApp"); // The name of the class // Register the window class. RegisterClassEx(&wcex); // Create the application window. // // Because the CreateWindow function takes its size in pixels, we // obtain the system DPI and use it to scale the window size. int dpiX = 0; int dpiY = 0; HDC hdc = GetDC(NULL); if (hdc) { dpiX = GetDeviceCaps(hdc, LOGPIXELSX); // Get the pixels from width dpiY = GetDeviceCaps(hdc, LOGPIXELSY); // Get the pixels from height ReleaseDC(NULL, hdc); } // Create the window m_hwnd = CreateWindow(TEXT("DemoApp"), // Class name. TEXT("CircuitSim"), // Window name. WS_OVERLAPPEDWINDOW |WS_HSCROLL | WS_VSCROLL, // Window style - WS_OVERLAPPEDWINDOW: The window is an overlapped window. CW_USEDEFAULT, // Use the default x position. CW_USEDEFAULT, // Use the default y position. static_cast<UINT>(ceil(640.f * dpiX / 96.f)), // Use the width, which we calculated with the pixels. static_cast<UINT>(ceil(480.f * dpiY / 96.f)), // Use the height, which we calculated with the pixels. NULL, // A handle to the parent window NULL, // A handle to a menu HINST_THISCOMPONENT, // A handle to the instance of the module this); // A pointer to a value to be passed to the window through the CREATESTRUCT structure // Check if the window passed the following checks - S_OK: Operation sucessful // E_FAIL: Unspecified failure hr = m_hwnd ? S_OK : E_FAIL; if (SUCCEEDED(hr)) { ShowWindow(m_hwnd, SW_MAXIMIZE); // Show the window - SW_MAXIMIZE: set the window to fullscreen UpdateWindow(m_hwnd); } return hr; }   Does anyone know the problem?  :huh:   Best regards MystikReasons