CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Mar 2010
    Location
    Aalten, Holland
    Posts
    14

    My selfmade game keeps crashing. HELP BADLY NEEDED

    Well hello,

    I created myself a game. I runs alright with Debugger, but without debugger, it crashes immediately.
    I tried to find the error, with cout. After each function or something I type a line like "cout << "DIRECTX::LoadTexture()\n";" or something similiar.

    Anyway, here is a piece of code.

    Code:
    IDAdd  = GUI::AddChild("Button", "Add Message", 100, 20, 698, 117, WS_VISIBLE | WS_CHILD | BS_BITMAP | BS_FLAT);	
    IDEdit = GUI::AddChild("Edit", "", 695, 20, 2, 117, WS_VISIBLE | WS_CHILD | WS_BORDER);
    IDList = GUI::AddChild("Listbox", "", 796, 125, 2, 2, WS_VISIBLE | WS_CHILD | WS_BORDER | WS_TABSTOP | WS_VSCROLL | LBS_DISABLENOSCROLL);
    
    cout<< "GUI::AddChild() Done\n";
    
    SendMessage(Childs[IDAdd],  BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)(HANDLE)LoadImage(NULL, "Images/AddMessage.bmp", IMAGE_BITMAP, 100, 20, LR_LOADFROMFILE));
    SendMessage(Childs[IDEdit], WM_SETFONT, (WPARAM)CreateFontA(15, 0, 0, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, "Comic Sans MS"), FALSE);
    SendMessage(Childs[IDList], WM_SETFONT, (WPARAM)CreateFontA(15, 0, 0, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, "Comic Sans MS"), FALSE);
    
    cout << "SendMessage() Done\n";
    
    Oldproc = (PROC)SetWindowLongPtr(Childs[1], GWL_WNDPROC, (DWORD)EditProc);
    cout << "Oldproc\n";
    assert(Oldproc);
    SetFocus(MainWnd);
    
    cout << "SetFocus() Done\n";
    
    cout << "DIRECTX:\n";
    DirectX		= new DIRECTX(MainWnd); // Creating DirectX
    cout << "DirectX = new DIRECTX(MainWnd);\n";
    The output was:
    Quote Originally Posted by Output
    GUI::AddChild() Done
    SendMessage() Done
    Oldproc
    SetFocus() Done
    DIRECTX:
    Its really weird. Because it crashes at the part where DIRECTX: is initialized.
    But the weird part is this:
    Code:
    DIRECTX::DIRECTX(HWND Window) {      
    	cout << "DIRECTX::DIRECTX\n";
    	DIRECTX::counter		= 0;
    	cout << "DIRECTX::counter\n";
    	DIRECTX::DXWindow		= Window;
    	cout << "DIRECTX::DXWindow\n";
    	DIRECTX::Interface		= 0;
    	cout << "DIRECTX::Interace\n";
    	DIRECTX::Device		= 0;
    	DIRECTX::Sprite		= 0;
    
    	DIRECTX::InitInterface();
    	cout << "DIRECTX::InitInterface();\n";
    	DIRECTX::InitDevice();
    	cout << "DIRECTX::InitDevice();\n";
    	DIRECTX::InitSprite();
    	cout << "DIRECTX::InitSprite();\n";
    
    }
    This is the Constructor of DIRECTX. But it immidiatly crashes after coming in the constructor, it doesn't even cout DIRECTX:IRECTX() T___T.

    I'm really stuck, does ANYBODY had this problem before? I really need to fix it, I'm so frustrated.

  2. #2
    Join Date
    Apr 2009
    Posts
    598

    Re: My selfmade game keeps crashing. HELP BADLY NEEDED


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured