Click here to Skip to main content
15,914,160 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionUpdateData giving run time error Pin
Dhiraj kumar Saini6-Sep-08 0:31
Dhiraj kumar Saini6-Sep-08 0:31 
AnswerRe: UpdateData giving run time error Pin
Gary R. Wheeler6-Sep-08 1:24
Gary R. Wheeler6-Sep-08 1:24 
GeneralRe: UpdateData giving run time error Pin
Dhiraj kumar Saini6-Sep-08 1:33
Dhiraj kumar Saini6-Sep-08 1:33 
GeneralRe: UpdateData giving run time error Pin
Gary R. Wheeler6-Sep-08 2:11
Gary R. Wheeler6-Sep-08 2:11 
GeneralRe: UpdateData giving run time error Pin
Dhiraj kumar Saini6-Sep-08 3:00
Dhiraj kumar Saini6-Sep-08 3:00 
GeneralRe: UpdateData giving run time error Pin
David Crow8-Sep-08 4:16
David Crow8-Sep-08 4:16 
AnswerRe: UpdateData giving run time error Pin
Cedric Moonen6-Sep-08 1:27
Cedric Moonen6-Sep-08 1:27 
QuestionFailed to Create Empty Document [modified] Pin
Sachindra Kumar Shukla5-Sep-08 23:24
Sachindra Kumar Shukla5-Sep-08 23:24 
while porting application code from VC++6 to VS2008 the call of CreateEx function is returning the false with the same parameters in VS2008 while with same parameter the call of CreateEx function is working fine in the VC++6.


The code flow is like this:

Called MFC's API CreateEx with the following prameter's

if ( !CreateEx( 0, AFX_WNDMDIFRAME, NULL, dwCreateStyle, 0, 0, 0, 0, pParentWnd->m_hWnd,
( HMENU)uID, NULL ) )
{
return FALSE;
}

Earlier in VC++6.0 this API was internally using the function ::CreateWindowEx then this function was returning the proper handle of the splitter window.

But now in VS2008 this API internally calls the function ::AfxCtxCreateWindowEx instead of ::CreateWindowEx. and this new function is returning the handle as NULL.

This code works properly for the main window but in case of splitter window it is failing.

In the application i have used a dynamic splitter window which is fully customized and derived from CWnd class.

If i changed the second parameter as STATIC of CreateEx functionn then it works fine but resizing of splitter window is not working and application is crashing.


Below is the function from where CreateEx is called............


BOOL CSplitterWndX::CreateCommon( const CWnd* const pParentWnd, const SIZE sizeMin, const DWORD dwStyle, const UINT uID )
{
ASSERT( pParentWnd != NULL );
ASSERT( ( sizeMin.cx >= 0 ) && ( sizeMin.cy >= 0 ) );
ASSERT( ( dwStyle & WS_CHILD ) );
ASSERT( uID != 0 );

ASSERT( ( m_pColInfo == NULL ) && ( m_pRowInfo == NULL ) );
ASSERT( ( m_nMaxCols > 0 ) && ( m_nMaxRows > 0 ) );

DWORD dwCreateStyle = dwStyle & ~( WS_HSCROLL | WS_VSCROLL );

if ( afxData.bWin4 )
{
dwCreateStyle &= ~WS_BORDER;
}

VERIFY( AfxEndDeferRegisterClass( AFX_WNDMDIFRAME_REG ) );

if ( !CreateEx( 0, AFX_WNDMDIFRAME, NULL, dwCreateStyle, 0, 0, 0, 0, pParentWnd->m_hWnd, ( HMENU )uID, NULL ) )
{
return FALSE;
}

TRY
{
m_pColInfo = new CRowColInfo[m_nMaxCols];
for ( int nCol = 0 ; nCol < m_nMaxCols ; nCol++ )
{
m_pColInfo[nCol].nMinSize = sizeMin.cx;
m_pColInfo[nCol].nIdealSize = 0;
m_pColInfo[nCol].nCurSize = -1;
m_pColInfo[nCol].bFixedSize = FALSE;
m_pColInfo[nCol].bAlwaysVisible = FALSE;
}

m_pRowInfo = new CRowColInfo[m_nMaxRows];
for ( int nRow = 0 ; nRow < m_nMaxRows ; nRow++ )
{
m_pRowInfo[nRow].nMinSize = sizeMin.cy;
m_pRowInfo[nRow].nIdealSize = 0;
m_pRowInfo[nRow].nCurSize = -1;
m_pRowInfo[nRow].bFixedSize = FALSE;
m_pRowInfo[nRow].bAlwaysVisible = FALSE;
}

m_pOldColInfo = new CRowColInfo[m_nMaxCols];
for ( int nCol = 0 ; nCol < m_nMaxCols ; nCol++ ) // Windows Vista Support 0.1
{
m_pOldColInfo[nCol].nMinSize = sizeMin.cx;
m_pOldColInfo[nCol].nIdealSize = 0;
m_pOldColInfo[nCol].nCurSize = -1;
m_pOldColInfo[nCol].bFixedSize = FALSE;
m_pOldColInfo[nCol].bAlwaysVisible = FALSE;
}

m_pOldRowInfo = new CRowColInfo[m_nMaxRows];
for ( int nRow = 0 ; nRow < m_nMaxRows ; nRow++ ) // Windows Vista Support 0.1
{
m_pOldRowInfo[nRow].nMinSize = sizeMin.cy;
m_pOldRowInfo[nRow].nIdealSize = 0;
m_pOldRowInfo[nRow].nCurSize = -1;
m_pOldRowInfo[nRow].bFixedSize = FALSE;
m_pOldRowInfo[nRow].bAlwaysVisible = FALSE;
}

SetScrollStyle( dwStyle );
}
CATCH_ALL( pE )
{
DestroyWindow();
return FALSE;
}
END_CATCH_ALL

return TRUE;
}


waiting for early response.....

Sachindra

modified on Sunday, September 7, 2008 6:15 AM

QuestionCopying a file Pin
programming.student5-Sep-08 21:47
programming.student5-Sep-08 21:47 
AnswerRe: Copying a file Pin
Cedric Moonen5-Sep-08 22:12
Cedric Moonen5-Sep-08 22:12 
AnswerRe: Copying a file Pin
Perspx5-Sep-08 22:45
Perspx5-Sep-08 22:45 
QuestionThreads Problem Pin
Dhiraj kumar Saini5-Sep-08 19:23
Dhiraj kumar Saini5-Sep-08 19:23 
AnswerRe: Threads Problem Pin
Cedric Moonen5-Sep-08 22:09
Cedric Moonen5-Sep-08 22:09 
QuestionCPrintDialog::GetPrinterDC question Pin
followait5-Sep-08 17:28
followait5-Sep-08 17:28 
AnswerRe: CPrintDialog::GetPrinterDC question Pin
Rane5-Sep-08 19:01
Rane5-Sep-08 19:01 
QuestionCalling functions in an executable or accessing its global variables from a DLL Pin
Ben Burnett5-Sep-08 12:09
Ben Burnett5-Sep-08 12:09 
AnswerRe: Calling functions in an executable or accessing its global variables from a DLL Pin
Garth J Lancaster5-Sep-08 14:23
professionalGarth J Lancaster5-Sep-08 14:23 
GeneralRe: Calling functions in an executable or accessing its global variables from a DLL Pin
Ben Burnett10-Sep-08 5:49
Ben Burnett10-Sep-08 5:49 
QuestionAfxMessageBox( ) in my DLL Pin
john john mackey5-Sep-08 12:01
john john mackey5-Sep-08 12:01 
AnswerRe: AfxMessageBox( ) in my DLL Pin
Perspx5-Sep-08 12:12
Perspx5-Sep-08 12:12 
GeneralRe: AfxMessageBox( ) in my DLL Pin
john john mackey5-Sep-08 12:25
john john mackey5-Sep-08 12:25 
QuestionShowing powers, cubes and squares in a console window Pin
toprogramminguy5-Sep-08 10:11
toprogramminguy5-Sep-08 10:11 
AnswerRe: Showing powers, cubes and squares in a console window Pin
David Crow5-Sep-08 10:21
David Crow5-Sep-08 10:21 
AnswerRe: Showing powers, cubes and squares in a console window Pin
Sauce!7-Sep-08 1:45
Sauce!7-Sep-08 1:45 
QuestionHelp! how to force the control to display the + even though the item does not have any child items inserted Pin
DavidLeeFromKunming5-Sep-08 9:35
DavidLeeFromKunming5-Sep-08 9:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.