Archived

This topic is now archived and is closed to further replies.

HellRiZZer

Application initialization problem

Recommended Posts

I GOT BIG PROBLEM! In this code
    
// Bezier Patch Editor.cpp : Defines the class behaviors for the application.

//


#include "stdafx.h"
#include "Bezier Patch Editor.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////

// CBezierPatchEditorApp


BEGIN_MESSAGE_MAP(CBezierPatchEditorApp, CWinApp)
	//{{AFX_MSG_MAP(CBezierPatchEditorApp)

	// NOTE - the ClassWizard will add and remove mapping macros here.

	// DO NOT EDIT what you see in these blocks of generated code!

	//}}AFX_MSG_MAP

END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////

// CBezierPatchEditorApp construction


CBezierPatchEditorApp::CBezierPatchEditorApp()
{
	// TODO: add construction code here,

	// Place all significant initialization in InitInstance

	m_lCurTime = 0;             
	m_dwTimeCount = 8;   
	m_lPerfCounter = 0;       
	m_bPerFlag = FALSE;    
	m_lNextTime = 0;    
	m_lLastTime = 0;	 
	m_dTimeElapsed = 0.0;	 
	m_dTimeScale = 0.0;		
	m_lFramesPerSecond = 90;

}

/////////////////////////////////////////////////////////////////////////////

// The one and only CBezierPatchEditorApp object


CBezierPatchEditorApp theApp;

/////////////////////////////////////////////////////////////////////////////

// CBezierPatchEditorApp initialization


BOOL CBezierPatchEditorApp::InitInstance()
{
	// Standard initialization


	// Change the registry key under which our settings are stored.


	// TODO: You should modify this string to be something appropriate

	// such as the name of your company or organization.

	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	// To create the main window, this code creates a new frame window

	// object and then sets it as the application's main window object.


	m_pMainWnd = NULL;
	CMainFrame* pFrame = new CMainFrame;
		
	if (!pFrame->Create(NULL, "Bezier Patch Editor v1.0"))
		return FALSE;

	m_pMainWnd = pFrame;
	
	m_pMainWnd->ShowWindow(m_nCmdShow);
	m_pMainWnd->UpdateWindow();

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////

// CBezierPatchEditorApp  Run


int CBezierPatchEditorApp::Run()
{
	if (!m_pMainWnd)
		AfxPostQuitMessage(0);

	MSG msg;
	CMainFrame* pFrame = STATIC_DOWNCAST ( CMainFrame, m_pMainWnd );

	if ( QueryPerformanceFrequency ( ( LARGE_INTEGER *) &m_lPerfCounter ) ) { 

		// yes, set m_dwTimeCount and timer choice flag 

		m_bPerFlag = TRUE;
		m_dwTimeCount = unsigned long(m_lPerfCounter / m_lFramesPerSecond);
		QueryPerformanceCounter ( ( LARGE_INTEGER * ) &m_lNextTime ); 
		m_dTimeScale = 1.0 / m_lPerfCounter;
	} else  { 
		// no performance counter, read in using timeGetTime 


		m_lNextTime = timeGetTime (); 
		m_dTimeScale = 0.001;
	} 
	// save time of last frame


	m_lLastTime = m_lNextTime;

	while ( TRUE ) {
		//see if there is a message waiting


		if ( ::PeekMessage ( &msg, NULL, 0, 0, PM_NOREMOVE ) ) { 
			do //if there is pump all waiting

			{
				if ( !PumpMessage () )
					return ExitInstance ();
			} while ( ::PeekMessage ( &msg, NULL, 0, 0, PM_NOREMOVE ) );
		} else {

			// use the appropriate method to get time 

			// and calculate elapsed time since last frame


			if ( m_bPerFlag ) {
				QueryPerformanceCounter ( ( LARGE_INTEGER * ) &m_lCurTime );	
			} else {
				m_lCurTime=timeGetTime (); 
			}

			// is it time to render the frame? 


			if ( m_lCurTime > m_lNextTime ) { 

				// calculate elapsed time


				m_dTimeElapsed = ( m_lCurTime - m_lLastTime ) * m_dTimeScale;
				

				// save frame time


				m_lLastTime = m_lCurTime;
				
				// yes, render the frame 


				if ( !pFrame->m_bAppIsActive )
					WaitMessage();
				else
					pFrame->RenderGLScene ();

				// set time for next frame 


				m_lNextTime = m_lCurTime + m_dwTimeCount; 

			} // end if


		} // end if else


	} // end while

	return msg.wParam;

} 
CBezierPatchEditorApp::~CBezierPatchEditorApp()
{
	delete m_pMainWnd;
}
/////////////////////////////////////////////////////////////////////////////

// CBezierPatchEditorApp message handlers

  

It gives me an KERNEL32.DLL Error 0xE06D7363 (Unhandled Exception)

Going deeper, it gives me an error at WINFRM.CPP at line 

      
m_strTitle = lpszWindowName;    // save title for later

  

Going even more deeper, it gives me an error at STRCORE.CPP at line  
      
AssignCopy(SafeStrlen(lpsz), lpsz);
  

Even MORE DEEPER at AssignCopy of CString method at 
      
AllocBeforeWrite(nSrcLen);   //CString method

    
And at last, in that method it says that nLen is = 0, but in other identical project with indetical code to this, it works just fine. WHY WHY???!??!!? PLEASE HELP! Thanks. " Do we need us? "

Ionware Productions - Games and Game Tools Development Edited by - felisandria on February 22, 2002 10:20:23 AM

Share this post


Link to post
Share on other sites