EDN Admin
Well-known member
Hello<br/><br/>My view class OnInitialUpdate is not being called by MFC. Instead, OnDraw gets called first and which gives lots of errors in my app becuase of the views variables not being initalized. Heres what I have of handling OnInitaliUpdate in both my .h and .cpp<br/><br/>CBlueViewView.h<br/><br/>
<pre> virtual void OnInitialUpdate ( );[/code]
CBlueViewView.cpp<br/><br/>
<pre><br/><br/><br/><br/><br/>void CBlueViewView::OnInitialUpdate( )
{
CView::OnInitialUpdate();
// Create the primary display device
if ( !CreateDisplay() ) { ShutDown( ); }
// Test the device capabilities.
if (!TestDeviceCaps( )) { ShutDown( ); }
// Build Objects
SceneAppInit();
// Set up all required game states
SetupGameState();
// Initialize device.
SetupRenderStates();
// Initalize input devices
if (!m_DI.InitInput( )) { ShutDown( ); }
}[/code]
<br/><br/>Some background if it might be some use to solving the issue. I have a assetviewer application that I was creating with directx and MFC and then I installed SP1 for Visual Studio 2008 to take advantage of some of its new MFC classes. So I moved my entire application over into a new project. I successfully removed all bugs and got it to work and run. But seemingly randomly when I was customing the ribbon bar through my derived classes <span style="font-size:x-small CBlueViewRibbonBar and <span style="font-size:x-small <span style="font-size:x-small CModelCategory, the problem suddenly started to happen. I dought that would be cuasing any problem becuase it was woking just fine using those classes for a while and I commented them out too but the problem did not fix. But I thought Id mention it just incase.<br/><br/>Thanks for any ideas or help
View the full article
<pre> virtual void OnInitialUpdate ( );[/code]
CBlueViewView.cpp<br/><br/>
<pre><br/><br/><br/><br/><br/>void CBlueViewView::OnInitialUpdate( )
{
CView::OnInitialUpdate();
// Create the primary display device
if ( !CreateDisplay() ) { ShutDown( ); }
// Test the device capabilities.
if (!TestDeviceCaps( )) { ShutDown( ); }
// Build Objects
SceneAppInit();
// Set up all required game states
SetupGameState();
// Initialize device.
SetupRenderStates();
// Initalize input devices
if (!m_DI.InitInput( )) { ShutDown( ); }
}[/code]
<br/><br/>Some background if it might be some use to solving the issue. I have a assetviewer application that I was creating with directx and MFC and then I installed SP1 for Visual Studio 2008 to take advantage of some of its new MFC classes. So I moved my entire application over into a new project. I successfully removed all bugs and got it to work and run. But seemingly randomly when I was customing the ribbon bar through my derived classes <span style="font-size:x-small CBlueViewRibbonBar and <span style="font-size:x-small <span style="font-size:x-small CModelCategory, the problem suddenly started to happen. I dought that would be cuasing any problem becuase it was woking just fine using those classes for a while and I commented them out too but the problem did not fix. But I thought Id mention it just incase.<br/><br/>Thanks for any ideas or help
View the full article